I am using the following config and seeing no output. Non-JSON object containing Syslog entries, as well as JSON object containing Syslog entries, are both being dropped. If I comment out the JSON parse then the JSON object successfully appears in the Grok'd syslog_message
field without any issue.
What I was trying to achieve was to detect early on whether a Syslog entry actually contains a JSON object, then only attempting to JSON parse it if it indeed appears to contain an object. I wasn't trying to get super crazy with my RegEx though, as either it should contain a JSON-looking object, or not.
Any ideas what I seem to be failing to account for here?
filter {
if [type] == "samba" {
grok {
match => { "message" => "%{SYSLOGBASE}\s*%{GREEDYDATA:syslog_message}" }
}
if [syslog_message] =~ /{.*}/ {
json {
source => "syslog_message"
}
grok {
match => {
"[Authorization][localAddress]" => "%{GREEDYDATA}:%{IP:[destination][ip]}:%{INT:[destination][port]}"
}
}
grok {
match => {
"[Authorization][remoteAddress]" => "%{GREEDYDATA}:%{IP:[source][ip]}:%{INT:[source][port]}"
}
}
mutate {
rename => [ "[Authorization][account]", "[user][name]" ]
}
} else {
drop { }
}
}
}