_grokparsefailure on Cisco Logs
Posted: Fri Mar 27, 2015 10:05 am
We have been looking for a si,ple logserver solution for some time now. We do find that Nagios LogServer is quite adecvate to our needs. Our goal for the time beeing is to collect syslog from some linux server, windows eventlogs and syslog from Cisco switched. i have been testing this solution for a few days now in order to validate the solution. Windows eventlogs and linux syslogs are parsed Ok but the Cisco logs not. I have created a Grok pattern and validated it using grokdebug.herokuapp.com. So here is the config:
Cisco log format:
Configuration used:
Grok pattern created and added to a new file in /usr/local/nagioslogserver/logstash/patterns:
And in the end the logs are not grokked correctly, could someone help?

Cisco log format:
Code: Select all
<189>166936: .Mar 27 2015 10:00:11.061 UTC: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/0/9, changed state to upCode: Select all
input {
syslog {
type => 'syslog'
port => 5544
}
tcp {
type => 'eventlog'
port => 3515
codec => json {
charset => 'CP1252'
}
}
tcp {
type => 'import_raw'
tags => 'import_raw'
port => 2056
}
tcp {
type => 'import_json'
tags => 'import_json'
port => 2057
codec => json
}
tcp {
port => 514
type => "syslog"
tags => [ "Cisco" ]
}
udp {
port => 514
type => "syslog"
tags => [ "Cisco" ]
}
}
filter {
if [program] == 'apache_access' {
grok {
match => [ 'message', '%{COMBINEDAPACHELOG}']
}
date {
match => [ 'timestamp', 'dd/MMM/yyyy:HH:mm:ss Z' ]
}
mutate {
replace => [ 'type', 'apache_access' ]
convert => [ 'bytes', 'integer' ]
convert => [ 'response', 'integer' ]
}
}
if "Cisco" in [tags] {
grok {
patterns_dir => "/usr/local/nagioslogserver/logstash/patterns"
match => [ "message", "<%{POSINT:seqnum1}>%{POSINT:seqnum2}:%{SPACE} .%{CISCOTIMESTAMPZ:cisco_timestamp}: \%%{DATA:facility}-%{POSINT:severity}-%{DATA:mnemonic}: %{GREEDYDATA:log_message}" ]
}
}
}
output {
elasticsearch { host => localhost }
stdout { codec => rubydebug }
}Code: Select all
CISCOTIMESTAMPZ %{MONTH} +%{MONTHDAY}(?: %{YEAR})? %{TIME} %{TZ}