-
Notifications
You must be signed in to change notification settings - Fork 477
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
Add new rewrite function: set-severity() #3115
Conversation
This user does not have permission to start the build. Can one of the admins verify this patch and start the build? |
2 similar comments
This user does not have permission to start the build. Can one of the admins verify this patch and start the build? |
This user does not have permission to start the build. Can one of the admins verify this patch and start the build? |
@kira-syslogng ok to test |
Build FAILURE |
Build FAILURE |
57aa8ea
to
7e0efd4
Compare
Signed-off-by: Kokan <[email protected]>
Changes the message level based on its numeric value: ``` rewrite { set-level("${user_macro}"); }; ``` The option is template that expects to be resolved into a numeric representation of a valid level. Signed-off-by: Kokan <[email protected]>
Signed-off-by: Kokan <[email protected]>
``` rewrite { set-level("critical"); }; ``` Now the macro accepts in text format the levels as well. Signed-off-by: Kokan <[email protected]>
Signed-off-by: Kokan <[email protected]>
Signed-off-by: Romain Tartière <[email protected]>
Signed-off-by: Romain Tartière <[email protected]>
Build FAILURE |
I fixed a bunch of refactoring mistakes yesterday, but kira is still failing. May someone with access to kira logs help by providing some insights about what is going wrong? Thanks! |
@smortex Only one test failed, and that failure is actually test case issue. (Cisco parser tests actually asserts on wrong priority value.) I'll push the fix tomorrow, and rerun kira. Also I plan to do a review, regarding the rename part. I'll probably have some not one backward compat. |
@kira-syslogng retest this please; branch=kokan-github-pr-3115 |
Build FAILURE |
The "emergency" severity has numerical code 0, so this value should be accepted as a valid severity for proper messages classification. Signed-off-by: Romain Tartière <[email protected]>
Build FAILURE |
@kira-syslogng retest this please branch=kokan-github-pr-3115; |
Build SUCCESS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smortex Thank you for opening, fixing, and finishing this PR! 👍
I've found 2 bugs, only one of them seems important (set-severity()
sets emerg
when its template evaluates to an empty string).
Build FAILURE |
@kira-syslogng retest this please branch=kokan-github-pr-3115; |
Build SUCCESS |
Signed-off-by: Romain Tartière <[email protected]>
When a template evaulates as an empty string, strtol() returns 0 and endptr[0] is NULL. This result in a misclassification of the message with a severity of 0, aka "emergency". Fix this by ensuring that there is nothing left to be read AND the end position is different from the start position. Signed-off-by: Romain Tartière <[email protected]>
Build FAILURE |
@kira-syslogng retest this please branch=kokan-github-pr-3115; |
Build SUCCESS |
Unfortunately, 20 years ago, syslog-ng choose the term "LEVEL" to refer to the severity of a message, as that was the language used by syslog(3) manual page. Quoting the manpage: The priority argument is formed by ORing together a facility value and a level value (described below). If no facility value is ORed into priority, then the default value set by openlog() is used, or, if there was no preceding openlog() call, a default of LOG_USER is employed. However RFC3164 adopted the term "severity", quoting RFC3164: The number contained within these angle brackets is known as the Priority value and represents both the Facility and Severity as described below. syslog-ng predates the choice in RFC3164, however I think it is highly time to adopt the language of the RFC, especially as it is better than the original. See discussions in github PR syslog-ng#3115 for further details. Signed-off-by: Balazs Scheidler <[email protected]>
Signed-off-by: László Várady <[email protected]>
Signed-off-by: László Várady <[email protected]>
This is a follow-up to #2602 by @Kokan
I rebased the code on top of master, fixed the build, and renamed the function
set-severity
as requested in #2602 (comment)A few more points where under discussion, I will add in-line notes to discuss the topics further.
This PR also fixes
cisco-parser
$PRIORITY macro parsing.Usage:
set-severtity(TEMPLATE)
Accepted values are numeric strings
[0-7]
or named values (emerg, emergency, panic, alert, crit, critical, err, error, warning, warn, notice, info, informational, debug
).Examples: