Example Logfile Entry which works perfectly in the Grok Debugger:
2018-11-21 08:15:54,809 WARN [com.xxx.mediaserver.tools.maintenance.FileMaintenance] (Thread-6) Not removing directory C:\xxx\mediaserver\import_export\SUPERVISOR\Downloads\packaged_ko_40186264_40186283 because we're not sure if it was created by us (directory name mismatch).
Here's the identification string:
%{DATE:date}%{SPACE}%{TIME:timestamp}%{SPACE}%{WORD:loglevel}%{SPACE}\[(?<class>.+?(?=]))\]%{SPACE}\((?<thread>.+?(?=\)))\)%{SPACE}(?<logmessage>.*)
And here's the logstash part:
grok { match => { "message" => "%{DATE:date}%{SPACE}%{TIME:timestamp}%{SPACE}%{WORD:loglevel}%{SPACE}[(?.+?(?=]))]%{SPACE}((?.+?(?=))))%{SPACE}(?.*)" } }
mutate { add_field => { "access_time" => "%{date} %{timestamp}" } }
date { match => [ "access_time", "YY-MM-dd HH:mm:ss,SSS" ] }
mutate {
remove_field => [ "SPACE" ]
remove_tag => [ "beats_input_codec_plain_applied", "monitor", "apache" ]
add_tag => [ "mediaserver" ]
In the field access_time i have this:
%{month} %{day} %{year} %{hour}:%{minute}:%{seconds}
so it seems, date parsing fails.
I also have this in field thread which makes no sense:
Thread-6) Not removing directory C:\xxx\mediaserver\import_export\SUPERVISOR\Downloads\packaged_ko_40186264_40186283 because we're not sure if it was created by us (directory name mismatch
because my regexp is parsing for the finishing ")" which works perfectly in Grok Debugger and ALSO in another part of the logstash config, which i post below:
This works perfectly:
else if [quelle] == "wildfly-main" { grok { match => { "message" => "%{DATE:date}%{SPACE}%{TIME:timestamp}%{SPACE}%{WORD:loglevel}%{SPACE}\[(?<class>.+?(?=:)):%{INT:linenumber}\]%{SPACE}\((?<thread>.+?(?=\)))\)%{SPACE}(?<logmessage>.*)" } } mutate { add_field => { "access_time" => "%{date} %{timestamp}" } } date { match => [ "access_time", "YY-MM-dd HH:mm:ss,SSS" ] } mutate { remove_field => [ "SPACE", "date", "timestamp", "message" ] remove_tag => [ "beats_input_codec_plain_applied", "monitor", "apache" ] add_tag => [ "wildfly" ] } }