Skip to content

Instantly share code, notes, and snippets.

@jhmartin
Created May 21, 2015 15:47
Show Gist options
  • Save jhmartin/c09e450853e273ee88f2 to your computer and use it in GitHub Desktop.
Save jhmartin/c09e450853e273ee88f2 to your computer and use it in GitHub Desktop.

Revisions

  1. jhmartin created this gist May 21, 2015.
    80 changes: 80 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,80 @@
    #http://pastebin.com/xGt6vv9R from yardenbar
    output {
    if [type] == "postfix" {
    elasticsearch {
    host => [ "ES_HOSTNAME" ]
    protocol => "transport"
    cluster => "elasticsearch"
    index => "postfix-%{+YYYY.MM.dd}"
    manage_template => true
    template_overwrite => true
    template => "/etc/logstash/templates.d/postfix.json"
    template_name => "postfix"
    }
    }
    else if [type] in ["nginx", "nginx_error"] {
    elasticsearch {
    host => [ "ES_HOSTNAME" ]
    protocol => "transport"
    cluster => "elasticsearch"
    index => "nginx-%{+YYYY.MM.dd}"
    manage_template => true
    template_overwrite => true
    template => "/etc/logstash/templates.d/nginx.json"
    template_name => "nginx"
    }
    }
    else if [type] == "rails" {
    elasticsearch {
    host => [ "ES_HOSTNAME" ]
    protocol => "transport"
    cluster => "elasticsearch"
    index => "rails-%{+YYYY.MM.dd}"
    manage_template => true
    template_overwrite => true
    template => "/etc/logstash/templates.d/rails.json"
    template_name => "rails"
    }
    }
    else if [type] == "webpagetest" {
    elasticsearch {
    host => [ "ES_HOSTNAME" ]
    protocol => "transport"
    cluster => "elasticsearch"
    index => "webpagetest-global"
    manage_template => true
    template_overwrite => true
    template => "/etc/logstash/templates.d/webpagetest.json"
    template_name => "webpagetest"
    }
    }
    else if [type] == "push-notification" {
    elasticsearch {
    host => [ "ES_HOSTNAME" ]
    protocol => "transport"
    cluster => "elasticsearch"
    index => "push-notification-%{+YYYY.MM.dd}"
    manage_template => true
    template_overwrite => true
    template => "/etc/logstash/templates.d/push_notification.json"
    template_name => "push_notification"
    }
    }
    else if [type] == "fastly" {
    elasticsearch {
    host => [ "ES_HOSTNAME" ]
    protocol => "transport"
    cluster => "elasticsearch"
    index => "fastly-%{+YYYY.MM.dd}"
    manage_template => true
    template_overwrite => true
    template => "/etc/logstash/templates.d/fastly.json"
    template_name => "fastly"
    }
    }
    else {
    file {
    path => "/var/log/logstash/unknown_messages.log"
    }
    }
    }