Thanks that helps... unfortunately I had to do something dirty and use a multiline codec to combine the lines, remove all of the \n
newline characters using a gsub and then write a grok filter to get the information out.
It's not pretty..but I got results.
INPUT
ENUM HEADER BLOCK DATE TIME 1184 LDAP FAILURE IN SEARCH RESULT SDABS 211214 134851800 SERVID USERID REASON 0 2 32 MOID ATTRBID
GROK
ENUM%{SPACE}HEADER%{SPACE}BLOCK%{SPACE}DATE%{SPACE}TIME %{NUMBER:ENUM}%{SPACE}%{DATA:HEADER}%{SPACE}%{WORD:BLOCK}%{SPACE}%{NUMBER:DATE}%{SPACE}%{NUMBER:TIME}%{SPACE}SERVID%{SPACE}USERID%{SPACE}REASON%{SPACE}%{NUMBER:SERVID}%{SPACE}%{NUMBER:USERID}%{SPACE}%{NUMBER:REASON}
OUTPUT
{
"ENUM": [
[
"1184"
]
],
"HEADER": [
[
"LDAP FAILURE IN SEARCH RESULT"
]
],
"BLOCK": [
[
"SDABS"
]
],
"DATE": [
[
"211214"
]
],
"TIME": [
[
"134851800"
]
],
"SERVID": [
[
"0"
]
],
"USERID": [
[
"2"
]
],
"REASON": [
[
"32"
]
]
}
Until you can get some way to better transform the output you are going to have to manually define your grok patterns.
My logstash output:
{
"USERID" => "2",
"message" => "ENUM HEADER BLOCK DATE TIME 1184 LDAP FAILURE IN SEARCH RESULT SDABS 211214 134851800 SERVID USERID REASON 0 2 32 MOID ATTRBID",
"@version" => "1",
"tags" => [
[0] "multiline"
],
"host" => "asp123.myserver.com",
"HEADER" => "LDAP FAILURE IN SEARCH RESULT",
"TIME" => "134851800",
"ENUM" => "1184",
"DATE" => "211214",
"SERVID" => "0",
"@timestamp" => 2021-12-22T19:16:38.162Z,
"REASON" => "32",
"BLOCK" => "SDABS"
}
[INFO ] 2021-12-22 14:16:40.609 [LogStash::Runner] runner - Logstash shut down.
Here's my logstash config:
input {
generator {
message => '
S P 2112141349 AF-7
EVENT REPORTING RESULT
ENUM HEADER BLOCK DATE TIME
1184 LDAP FAILURE IN SEARCH RESULT SDABS 211214 134851700
SERVID USERID REASON
0 2 32
MOID
ATTRBID
ENUM HEADER BLOCK DATE TIME
1184 LDAP FAILURE IN SEARCH RESULT SDABS 211214 134851800
SERVID USERID REASON
0 2 32
MOID
ATTRBID
ENUM HEADER BLOCK DATE TIME
1184 LDAP FAILURE IN SEARCH RESULT SDABS 211214 134851800
SERVID USERID REASON
0 2 32
MOID
ATTRBID
'
count => 1
codec => multiline {
pattern => 'ENUM HEADER BLOCK DATE TIME'
what => previous
negate => true
}
}
}
filter {
mutate {
gsub => ["message","\n"," "]
}
grok {
match => {"message" => "ENUM%{SPACE}HEADER%{SPACE}BLOCK%{SPACE}DATE%{SPACE}TIME %{NUMBER:ENUM}%{SPACE}%{DATA:HEADER}%{SPACE}%{WORD:BLOCK}%{SPACE}%{NUMBER:DATE}%{SPACE}%{NUMBER:TIME}%{SPACE}SERVID%{SPACE}USERID%{SPACE}REASON%{SPACE}%{NUMBER:SERVID}%{SPACE}%{NUMBER:USERID}%{SPACE}%{NUMBER:REASON}"}
}
}
output {
stdout{}
}