Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filebeat/input/syslog: Improve Cisco log parsing #37748

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Added a fix for Crowdstrike pipeline handling process arrays {pull}36496[36496]
- Fix m365_defender cursor value and query building. {pull}37116[37116]
- Fix TCP/UDP metric queue length parsing base. {pull}37714[37714]
- Add support for cisco logs with hostname in syslog input {pull}37748[37748]

*Heartbeat*

Expand Down
44 changes: 43 additions & 1 deletion filebeat/input/syslog/input_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,49 @@ func TestParseAndCreateEvent3164(t *testing.T) {
},
},
},

"cisco": {
data: []byte("<190>589265: Feb 8 18:55:31.306: %SEC-11-IPACCESSLOGP: list 177 denied udp 10.0.0.1(53640) -> 10.100.0.1(15600), 1 packet"),
expected: mapstr.M{
"event": mapstr.M{
"severity": 6,
},
"event.sequence": 589265,
"log": mapstr.M{
"source": mapstr.M{
"address": "127.0.0.1",
},
},
"message": "%SEC-11-IPACCESSLOGP: list 177 denied udp 10.0.0.1(53640) -> 10.100.0.1(15600), 1 packet",
"syslog": mapstr.M{
"facility": 23,
"facility_label": "local7",
"priority": 190,
"severity_label": "Informational",
},
},
},
"cisco with hostname": {
data: []byte("<190>589265: TESTHOST1234: Feb 8 18:55:31.306: %SEC-11-IPACCESSLOGP: list 177 denied udp 10.0.0.1(53640) -> 10.100.0.1(15600), 1 packet"),
expected: mapstr.M{
"event": mapstr.M{
"severity": 6,
},
"event.sequence": 589265,
"log": mapstr.M{
"source": mapstr.M{
"address": "127.0.0.1",
},
},
"hostname": "TESTHOST1234",
"message": "%SEC-11-IPACCESSLOGP: list 177 denied udp 10.0.0.1(53640) -> 10.100.0.1(15600), 1 packet",
"syslog": mapstr.M{
"facility": 23,
"facility_label": "local7",
"priority": 190,
"severity_label": "Informational",
},
},
},
"invalid data": {
data: []byte("invalid"),
expected: mapstr.M{
Expand Down
8 changes: 6 additions & 2 deletions filebeat/input/syslog/parser/syslog_rfc3164.rl
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,13 @@
syslogprog = program ("[" pid "]")? ":" space;
message = any+>tok %message;
msg = syslogprog? message>tok %message;
sequence = digit+ ":" space>tok %sequence;

main := (prio)?(sequence)? (header msg | timestamp space message | message);
# Cisco fields.
sequence = digit+ >tok %sequence;
ciscohostname = [\.\-0-9a-zA-Z]+ >tok %hostname;
ciscofields = (sequence ":" space) (ciscohostname ":" space)?;

main := (prio)?(ciscofields)? (header msg | timestamp space message | message);
catch_all := message;

}%%
Loading
Loading