I have installed file beat agents for different service and pointed them to Logstash and applied my filter for it but noticed multiple logs are coming in a single log even though i was using multi line pattern to differentiate my logs based on Timestamp.
sample log:
2018-10-24 11:39:50.815 [http-nio-8080-exec-9] [XXXX] [supportops@XXXX.com] INFO c.s.m.c.BusinessClassCodeController - getBusinessClassCodes :Retrieving Business Class Code by CodeType :business-class-one and size :: 1
filebeat configuration
multiline.pattern: '[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}'
multiline.negate: true
multiline.match: after
Grok filter
input { beats
{
port => 5044
}
}
filter {
grok {
match => [ "message","(?<timestamp>%{YEAR}[/-]%{MONTHNUM}[/-]%{MONTHDAY}[/ ]%{HOUR}:%{MINUTE}(?::%{SECOND})(?![0-9]))\s+(\[%{USERNAME:thread}\])\s+(\[%{USERNAME:tenentId}\])\s+(\[(?<userId>%{WORD}+@[0-9A-Za-z][0-9A-Za-z-]{0,62}+\w+.[a-z]{0,62})\]) %{WORD:loglevel} %{JAVACLASS:classname} %{GREEDYDATA:logmessage}"]
match => [ "message","(?<timestamp>%{YEAR}[/-]%{MONTHNUM}[/-]%{MONTHDAY}%{SPACE}%{HOUR}:%{MINUTE}(?::%{SECOND})(?![0-9]))\s+(\[%{USERNAME:thread}\])\s+(\[%{SPACE}])\s+(\[%{SPACE}])%{SPACE}%{WORD:loglevel}%{SPACE}%{JAVACLASS:classname}%{SPACE}[/-]%{GREEDYDATA:logmessage}"]
}
mutate { remove_field => [ "[beat][name]", "[host][name]", "[beat][version]", "offset","[input][type]"] }
}
output {
elasticsearch { hosts => ["localhost:9200"] }
stdout { codec => rubydebug }
}
Filter is applied successfully but i am seeing multiple logs i.e next logs till an extent are attached as greedy data as below.
Output from kibana only logmessage is given hear
logmessage : - getDayparts :Retrieving all DayPart :: 13
2018-10-24 11:39:50.815 [http-nio-8080-exec-9] [XXXX] [supportops@XXXX.com] INFO c.s.m.c.BusinessClassCodeController - getBusinessClassCodes :Retrieving Business Class Code by CodeType :business-class-one and size :: 1
2018-10-24 11:39:51.010 [http-nio-8080-exec-1] [XXXX] [supportops@XXXX.com] INFO c.s.m.c.BusinessClassCodeController - getBusinessClassCodes :Retrieving Business Class Code by CodeType :business-class-three and size :: 1