I have the below multiline log:
2020-05-27 11:59:17 ----------------------------------------------------------------------
2020-05-27 11:59:17 Got context
2020-05-27 11:59:17 Raw context:
EMAIL=abc.def@example.com
NAME=abc.def
PAGER=+11111111111111
DATE=2020-05-27
AUTHOR=
COMMENT=
ADDRESS=1.1.1.1
ALIAS=abc.example.com
ATTEMPT=1
2020-05-27 11:59:17 Previous service hard state not known. Allowing all states.
2020-05-27 11:59:17 Computed variables:
URL=abc.example.com
STATE=UP
2020-05-27 11:59:17 Preparing flexible notifications for abc.def
2020-05-27 11:59:17 channel with plugin sms
2020-05-27 11:59:17 - Skipping: set
2020-05-27 11:59:17 channel with plugin plain email
2020-05-27 11:59:20 --------------------------------------------------------------------
This is my logstash config:
input {
stdin { }
}
filter {
grok {
match => { "message" => "(?m)%{GREEDYDATA:data}"}
}
if [data] {
mutate {
gsub => [
"data", "^\s*", ""
]
}
mutate {
gsub => ['data', "\n", " "]
}
}
}
output {
stdout { codec => rubydebug }
}
And Filebeat config
multiline.pattern: '^[[:space:]][A-Za-z]* (?m)'
multiline.negate: false
multiline.match: after
What I need is -
After the multiline log has been processed by filebeat, the log will get split into multiple lines. One such line is
2020-05-27 11:59:17 Raw notification context:
EMAIL=abc.def@example.com
NAME=abc.def
PAGER=+11111111111111
DATE=2020-05-27
AUTHOR=
COMMENT=
ADDRESS=1.1.1.1
ALIAS=abc.example.com
ATTEMPT=1
Now, I want to extract each key value pair using the kv filter and it should show as like one single message like the above but then also have query_string_key=value assigned to it.
How to achieve this ?