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

[libbeat] Fix parsing of RFC 3164 process IDs in syslog processor #38982

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Expand Up @@ -91,6 +91,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Change cache processor documentation from `write_period` to `write_interval`. {pull}38561[38561]
- Fix cache processor expiries heap cleanup on partial file writes. {pull}38561[38561]
- Fix cache processor expiries infinite growth when large a large TTL is used and recurring keys are cached. {pull}38561[38561]
- Fix parsing of RFC 3164 process IDs in syslog processor. {issue}38947[38947] {pull}38982[38982]

*Auditbeat*
- Set field types to correctly match ECS in sessionmd processor {issue}38955[38955] {pull}38994[38994]
Expand Down
2 changes: 1 addition & 1 deletion libbeat/reader/syslog/parser/rfc3164.rl
Expand Up @@ -16,7 +16,7 @@
hostname = graph+ >tok %set_hostname;

tag = (print -- [ :\[])+ >tok %set_tag;
content_value = print+ >tok %set_content;
content_value = digit+ >tok %set_content;
content = '[' content_value ']';
msg = (tag content? ':' sp)? any+ >tok %set_msg;
}%%
60 changes: 5 additions & 55 deletions libbeat/reader/syslog/rfc3164_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions libbeat/reader/syslog/rfc3164_test.go
Expand Up @@ -88,6 +88,19 @@ func TestParseRFC3164(t *testing.T) {
msg: "message",
},
},
"ok-procid-with-square-brackets-msg": {
in: "<114>Apr 12 13:30:01 aaaaaa001.adm.domain aaaaaa001[25259]: my.some.domain 10.11.12.13 - USERNAME [12/Apr/2024:13:29:59.993 +0200] /skodas \"GET /skodas/group/pod-documentation/aaa HTTP/1.1\" 301 301 290bytes 1 10327",
want: message{
timestamp: mustParseTime(time.Stamp, "Apr 12 13:30:01", time.Local),
priority: 114,
facility: 14,
severity: 2,
hostname: "aaaaaa001.adm.domain",
process: "aaaaaa001",
pid: "25259",
msg: "my.some.domain 10.11.12.13 - USERNAME [12/Apr/2024:13:29:59.993 +0200] /skodas \"GET /skodas/group/pod-documentation/aaa HTTP/1.1\" 301 301 290bytes 1 10327",
},
},
"err-pri-not-a-number": {
in: "<abc>Oct 11 22:14:15 test-host this is the message",
want: message{
Expand Down