Skip to content

Instantly share code, notes, and snippets.

@thikade
Created April 5, 2015 11:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thikade/d9dac01a132eb7ea4067 to your computer and use it in GitHub Desktop.
Save thikade/d9dac01a132eb7ea4067 to your computer and use it in GitHub Desktop.
logstash config example using custom grok filters
input {
file {
type => "WASSystemOut"
start_position => "beginning"
# path => ["/var/log/secure", "/var/log/messages"]
# exclude => ["*.gz"]
path => ["/waslogs/SystemOut*log"]
}
}
filter {
if [type] == "WASSystemOut" {
if [message] !~ /SLOW SERVICE DETECTED/ {
drop {}
}
grok {
match => [ "message", "\[%{DATESTAMP:datetime} %{WORD}\] %{GREEDYDATA}SLOW SERVICE DETECTED: time: %{INT:duration:int} ms class (?<slowservicename>(?:[A-z0-9-]+\.)+[A-z0-9$]+)" ]
add_tag => [ "slow-service", "grokked" ]
}
date {
match => [ "datetime", "M/d/yy HH:mm:ss:SSS" ]
timezone => [ "CET" ]
add_tag => [ "dated" ]
}
}
}
output {
# stdout { codec => rubydebug }
file {
message_format => "%{@timestamp};%{slowservicename};%{duration}"
path => "/tmp/logstash.out"
}
elasticsearch { }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment