_grokparsefailure while reading logs from file by logstash

(Maciej Kola) #1

Hi Mates,

Can anyone please tell me, why I got "_grokparsefailure" while reading logs from file? My logs look like this:

2016-01-27T21:17:31+01:00 %ASA-1-302013: Built outbound TCP connection 890918059 for test: ( to inside: (

I have searched forum and google and I found out that grok thinks that it's not a "syslog style" log. But it is (at least it is a file saved by rsyslog on CentOS 7 so I assume that it's compatible with RFC).

My grok filter:

filter {
if [type] == "syslog" {
grok {
match => { "message" => "<%{POSINT:syslog_pri}>%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} %{DATA:syslog_program}(?:[%{POSINT:syslog_pid}])?: %{GREEDYDATA:syslog_message}" }

(Magnus B├Ąck) #2

Your grok expression isn't even close to matching the actual log data. The grok expresion you use would parse a log that looks something like this:

<13>Jan 28 08:21:29 hostname smartd[4016]: Device: /dev/sdb [SAT], SMART Usage Attribute: 194 Temperature_Celsius changed from 32 to 33

Your expression should probably begin like this:

%{TIMESTAMP_ISO8601:syslog_timestamp} %{IP:host}

(system) #3