X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/770c70870a3e3e3ab59afabce3654687d9bc2cdb..15a6ed4cd248aeb1c47ddc349ce6cc2172bf8489:/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 0ddab7b2f..6610cd414 100644 --- a/cookbooks/logstash/templates/default/logstash.conf.erb +++ b/cookbooks/logstash/templates/default/logstash.conf.erb @@ -14,6 +14,24 @@ filter { 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" @@ -25,12 +43,36 @@ filter { "[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" ] } }