Created
April 5, 2015 11:54
-
-
Save thikade/d9dac01a132eb7ea4067 to your computer and use it in GitHub Desktop.
logstash config example using custom grok filters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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