"Hello.
I have several sources of syslogs that I want to filter with logstash grok, have some issue and questions about this syslog event and how to use grok.
{"@version":"1","message":"<44> Sep 14 09:01:09 172.24.4.202 FFI: port 1-Excessive undersized/giant packets. See help.","host":"1.2.3.4","type":"syslog","@timestamp":"2021-09-14T07:01:07.962Z"}
So far I have with created this grok:
%{INT:version}\S+%{NONNEGINT:syslog-priority:int}\S+%{GREEDYDATA:message}
Results:
{
"version": [
[
"1"
]
],
"syslog": [
[
"44"
]
],
"message": [
[
" Sep 14 09:01:09 172.24.4.202 FFI: port 1-Excessive undersized/giant packets. See help.","host":"172.24.4.202","type":"syslog","@timestamp":"2021-09-14T07:01:07.962Z"}"
]
]
}
My issue is that I want to parse "@timestamp" , "type" and "host" and then leave the rest as GREEDYDATA message.
I have tried with the timestamp first:
%{INT:version}\S+%{NONNEGINT:syslog-priority:int}\S+%{GREEDYDATA:message}%{TIMESTAMP_ISO8601:SyslogTimestamp}
Results:
{
"version": [
[
"1"
]
],
"syslog": [
[
"44"
]
],
"message": [
[
" Sep 14 09:01:09 172.24.4.202 FFI: port 1-Excessive undersized/giant packets. See help.","host":"172.24.4.202","type":"syslog","@timestamp":"20"
]
],
"SyslogTimestamp": [
[
"21-09-14T07:01:07.962Z"
]
],
"YEAR": [
[
"21"
]
],
As it looks like the grok pattern can not parse the YEAR field correctly because 20 is missing
Any ideas on what I am missing
//Christer