]> git.openstreetmap.org Git - chef.git/blob - cookbooks/logstash/templates/default/logstash.conf.erb
fc577b9b42646038f09a6cdcf300dd004c8c605e
[chef.git] / cookbooks / logstash / templates / default / logstash.conf.erb
1 input {
2   lumberjack {
3     port => 5043
4     ssl_certificate => "/var/lib/logstash/lumberjack.crt"
5     ssl_key => "/var/lib/logstash/lumberjack.key"
6   }
7 }
8
9 filter {
10   if [type] == "apache" {
11     grok {
12       match => [ "message", "%{COMBINEDAPACHELOG} %{NUMBER:duration:int}us %{NOTSPACE:request_id} %{NOTSPACE:ssl_protocol} %{NOTSPACE:ssl_cipher}" ]
13     }
14     date {
15       match => [ "timestamp", "dd/MMM/yyyy:HH:mm:ss Z" ]
16     }
17     if [agent] == "-" {
18       mutate {
19         remove_field => [ "agent" ]
20       }
21     } else {
22       useragent {
23         source => "agent"
24         target => "useragent"
25       }
26       grok {
27         match => { "agent" => "%{JOSM:[useragent][name]=JOSM}/%{POSINT:[useragent][major]}\.%{POSINT:[useragent][minor]} \(%{POSINT:[useragent][patch]} \w+\) " }
28         overwrite => [ "[useragent][name]", "[useragent][major]", "[useragent][minor]", "[useragent][patch]" ]
29         tag_on_failure => []
30       }
31       mutate {
32         rename => { "agent" => "[useragent][raw]" }
33       }
34     }
35   } else if [type] == "rails" {
36     json {
37       source => "message"
38       remove_field => [
39         "message",
40         "[parameters][authenticity_token]",
41         "[parameters][pass_crypt]",
42         "[parameters][pass_crypt_confirmation]",
43         "[parameters][utf8]"
44       ]
45     }
46   }
47
48   if [host] =~ /^spike-/ {
49     mutate {
50       add_tag => [ "frontend" ]
51     }
52   } else if [host] =~ /^thorn-/ {
53     mutate {
54       add_tag => [ "backend" ]
55     }
56   }
57 }
58
59 output {
60   elasticsearch {
61     hosts => [ "127.0.0.1" ]
62   }
63 }