I am very new with Logstash, trying to create my first config. I am using 1.5.6 version.
As I am testing, I wanted to try to use db2 log file as input. Got the multiline thing working fine. Example of my event:
"2016-02-26-14.51.45.577696-360 I959779E406 LEVEL: Warning\nPID : 24767 TID : 140656464664352 PROC : db2star2\nINSTANCE: db2inst1 NODE : 000\nHOSTNAME: opsmgmt01.wdc01.unica.com\nFUNCTION: DB2 UDB, base sys utilities, sqleReleaseStStLockFile, probe:14016\nMESSAGE : Released lock on the file:\nDATA #1 : String, 39 bytes\n/home/db2inst1/sqllib/ctrl/db2stst.0000"
I want to get rid of everything after LEVEL:Warning.
This is my filter:
filter {
grok {
match => { message => "%{YEAR}[-]%{MONTHNUM}[-]%{MONTHDAY}[-]%{HOUR}[.]%{MINUTE}[.]%{SECOND}[-]%{INT}%{SPACE}[0-9a-zA-Z]{10,}%{SPACE}+%{WORD}[:]%{SPACE}%{WORD:loglevel}%{GREEDYDATA:therest}" }
}
mutate { remove_field => [ "therest" ] }
}
I used grok debugger and it displays "therest" correctly.
My output:
output {
if [loglevel] not in ["Info","Event"] {
stdout { codec => rubydebug }
email { to => "mivkovic@xyz.com"
subject => "check db2 instance log"
from => "root@%{host}"
body => "Here is the event: %{message}" }
}
}
On my stdout, I see message as the whole thing, including "therest" field. Same thing for my email message body.
How does my new message becomes everything but "therest" field?
Many thanks!