X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/c0e7998c9ebe94839c9401964be2ad6609bb5ea9..49e90bd4f3154ad5b3a542c7aad648b008dfe844:/cookbooks/logstash/templates/default/logstash.conf.erb?ds=sidebyside diff --git a/cookbooks/logstash/templates/default/logstash.conf.erb b/cookbooks/logstash/templates/default/logstash.conf.erb index 68c9fd921..cbc8c909b 100644 --- a/cookbooks/logstash/templates/default/logstash.conf.erb +++ b/cookbooks/logstash/templates/default/logstash.conf.erb @@ -1,29 +1,79 @@ input { - lumberjack { - port => 5043 - ssl_certificate => "/var/lib/logstash/lumberjack.crt" - ssl_key => "/var/lib/logstash/lumberjack.key" + beats { + port => 5044 + ssl => true + ssl_certificate => "/var/lib/logstash/beats.crt" + ssl_key => "/var/lib/logstash/beats.key" } } filter { if [type] == "apache" { grok { - match => [ "message", "%{COMBINEDAPACHELOG} %{NUMBER:duration:int}us %{WORD:request_id} %{NOTSPACE:ssl_protocol} %{NOTSPACE:ssl_cipher}" ] + match => [ "message", "%{COMBINEDAPACHELOG} %{NUMBER:duration:int}us %{NOTSPACE:request_id} %{NOTSPACE:ssl_protocol} %{NOTSPACE:ssl_cipher}" ] } date { match => [ "timestamp", "dd/MMM/yyyy:HH:mm:ss Z" ] } + if [agent] == "-" { + mutate { + remove_field => [ "agent" ] + } + } else { + useragent { + source => "agent" + target => "useragent" + } + grok { + match => { "agent" => "%{JOSM:[useragent][name]=JOSM}/%{POSINT:[useragent][major]}\.%{POSINT:[useragent][minor]} \(%{POSINT:[useragent][patch]} \w+\) " } + overwrite => [ "[useragent][name]", "[useragent][major]", "[useragent][minor]", "[useragent][patch]" ] + tag_on_failure => [] + } + mutate { + rename => { "agent" => "[useragent][raw]" } + } + } } else if [type] == "rails" { json { source => "message" + remove_field => [ + "message", + "[parameters][authenticity_token]", + "[parameters][pass_crypt]", + "[parameters][pass_crypt_confirmation]", + "[parameters][utf8]" + ] + } + if [duration] { + ruby { + code => "event['duration'] = Integer(event['duration'] * 1000000)" + } + } + if [db] { + ruby { + code => "event['db'] = Integer(event['db'] * 1000000)" + } + } + if [view] { + ruby { + code => "event['view'] = Integer(event['view'] * 1000000)" + } + } + } + + if [host] =~ /^spike-/ { + mutate { + add_tag => [ "frontend" ] + } + } else if [host] =~ /^thorn-/ { + mutate { + add_tag => [ "backend" ] } } } output { elasticsearch { - host => [ "127.0.0.1" ] - cluster => "<%= node[:elasticsearch][:cluster][:name] %>" + hosts => [ "127.0.0.1" ] } }