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

check program name for rfc3164 #380

Merged
merged 5 commits into from
Nov 18, 2024
Merged

Conversation

bshifter
Copy link
Member

The check-program flag was added to validate the program field in syslog format. It verifies that the program field contains only the allowed characters '[a-zA-Z0-9].-_/()' and requires at least one alphabetical character in the program name. If these conditions are not met, it treats the program field and the remaining fields as part of the log message. This approach avoids using regular expressions to improve performance.

examples:

log {
    source { tcp(port(2000) flags(check-hostname, check-program, dont-store-legacy-msghdr)); };
...

Copy link
Contributor

github-actions bot commented Nov 14, 2024

This Pull Request introduces config grammar changes

axoflow/0b99654805acc81e18d5d0cf1c6c3e25fac92b9d -> bshifter/logmsg-check-program

--- a/options
+++ b/options

 global-options(
+    check-program(<yesno>)
 )

--- a/parser
+++ b/parser

 syslog-parser(
     flags(
+        check-program
     )
 )

--- a/source
+++ b/source

 fifo(
+    check-program(<yesno>)
     flags(
+        check-program
     )
 )

 file(
+    check-program(<yesno>)
     flags(
+        check-program
     )
 )

 network(
+    check-program(<yesno>)
     flags(
+        check-program
     )
 )

 pipe(
+    check-program(<yesno>)
     flags(
+        check-program
     )
 )

 program(
+    check-program(<yesno>)
     flags(
+        check-program
     )
 )

 stdin(
+    check-program(<yesno>)
     flags(
+        check-program
     )
 )

 syslog(
+    check-program(<yesno>)
     flags(
+        check-program
     )
 )

 systemd-syslog(
+    check-program(<yesno>)
     flags(
+        check-program
     )
 )

 tcp(
+    check-program(<yesno>)
     flags(
+        check-program
     )
 )

 tcp6(
+    check-program(<yesno>)
     flags(
+        check-program
     )
 )

 udp(
+    check-program(<yesno>)
     flags(
+        check-program
     )
 )

 udp6(
+    check-program(<yesno>)
     flags(
+        check-program
     )
 )

 unix-dgram(
+    check-program(<yesno>)
     flags(
+        check-program
     )
 )

 unix-stream(
+    check-program(<yesno>)
     flags(
+        check-program
     )
 )

 wildcard-file(
+    check-program(<yesno>)
     flags(
+        check-program
     )
 )

@bshifter bshifter changed the title axorouter-framework: check program name for rfc3164 check program name for rfc3164 Nov 14, 2024
@bshifter bshifter force-pushed the logmsg-check-program branch from 4bd3790 to fd113ac Compare November 14, 2024 14:09
Copy link
Member

@MrAnno MrAnno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM otherwise.

(We may also need a NEWS file entry).

lib/cfg-grammar.y Show resolved Hide resolved
lib/logmsg/logmsg.h Show resolved Hide resolved
modules/syslogformat/syslog-format.c Outdated Show resolved Hide resolved
modules/syslogformat/syslog-format.c Show resolved Hide resolved
@bshifter bshifter force-pushed the logmsg-check-program branch from fd113ac to ad3a54d Compare November 15, 2024 15:43
@MrAnno MrAnno self-requested a review November 17, 2024 22:53
@MrAnno
Copy link
Member

MrAnno commented Nov 18, 2024

LGTM. We can merge it after adding a news entry.

Signed-off-by: shifter <shifter@axoflow.com>
Signed-off-by: shifter <shifter@axoflow.com>
Signed-off-by: shifter <shifter@axoflow.com>
Signed-off-by: shifter <shifter@axoflow.com>
@bshifter bshifter force-pushed the logmsg-check-program branch 2 times, most recently from 651e705 to 889b8b7 Compare November 18, 2024 14:40
MrAnno
MrAnno previously approved these changes Nov 18, 2024
Signed-off-by: shifter <shifter@axoflow.com>
@MrAnno MrAnno merged commit e152a6c into axoflow:main Nov 18, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants