fix(syslog): normalize syslog severity to lowercase in VRL validation#3326
fix(syslog): normalize syslog severity to lowercase in VRL validation#3326vparfonov wants to merge 1 commit into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughSyslog output generation now lowercases ChangesSyslog severity casing
Estimated code review effort: 2 (Simple) | ~12 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
/hold |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jcantrill, vparfonov The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
internal/generator/vector/output/syslog/syslog.go (1)
98-101: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winFacility conversion has the same case-sensitivity gap but wasn't fixed.
The
Facilityfield docs state values can be case-insensitive keywords (e.g.user,local0, etc.), same asSeverity. The facility block directly above (Lines 79-96) still callsto_syslog_facility_code(._syslog.facility)without any downcase normalization, so capitalized facility keywords would still trip the same "Invalid syslog facility value" warning this PR is fixing for severity.Consider applying the identical
downcase(to_string!(...))normalization to._syslog.facilityfor consistency.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/generator/vector/output/syslog/syslog.go` around lines 98 - 101, The syslog generator still has the same case-sensitivity bug for facility values that was fixed for severity. Update the facility handling in the syslog transform block around the existing to_syslog_facility_code(._syslog.facility) call to normalize ._syslog.facility with downcase(to_string(...)) before conversion, mirroring the severity logic in the same output generator so capitalized keywords like local0 and user are accepted consistently.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/generator/vector/output/syslog/syslog.go`:
- Around line 98-101: The syslog severity normalization in the
`._syslog.severity` handling block uses a fallible string conversion, which can
break the shared remap. Update the severity assignment in the syslog transform
to use `to_string!()` (or add equivalent explicit error handling) before
`downcase(...)`, since the value may come from `.level` and must not rely on an
infallible conversion.
In `@internal/generator/vector/output/syslog/tcp_with_tuning.toml`:
- Around line 50-53: The syslog severity normalization in the remap block uses a
fallible to_string() call, which can break VRL compilation before downcase()
runs. Update the logic in the severity handling path so the conversion is
handled explicitly, using to_string!(...) or a fallback with ?? before passing
the value to downcase(), and keep the change localized to the ._syslog.severity
normalization in the syslog TCP tuning generator.
---
Nitpick comments:
In `@internal/generator/vector/output/syslog/syslog.go`:
- Around line 98-101: The syslog generator still has the same case-sensitivity
bug for facility values that was fixed for severity. Update the facility
handling in the syslog transform block around the existing
to_syslog_facility_code(._syslog.facility) call to normalize ._syslog.facility
with downcase(to_string(...)) before conversion, mirroring the severity logic in
the same output generator so capitalized keywords like local0 and user are
accepted consistently.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 2a5375f6-9e3b-4110-9d13-19703ef1b743
📒 Files selected for processing (9)
internal/generator/vector/output/syslog/rfc3164_with_defaults.tomlinternal/generator/vector/output/syslog/syslog.gointernal/generator/vector/output/syslog/tcp_with_defaults.tomlinternal/generator/vector/output/syslog/tcp_with_kubernetes_minimal_enrichment.tomlinternal/generator/vector/output/syslog/tcp_with_tuning.tomlinternal/generator/vector/output/syslog/tls_with_field_references.tomlinternal/generator/vector/output/syslog/udp_with_every_setting.tomltest/functional/outputs/syslog/rfc3164_test.gotest/functional/outputs/syslog/rfc5424_test.go
|
/retest-required |
3 similar comments
|
/retest-required |
|
/retest-required |
|
/retest-required |
|
/lgtm |
|
/test e2e-target |
|
/test e2e-target |
|
/lgtm |
|
/hold cancel |
|
/hold |
b8704a8 to
58f60c0
Compare
|
/retest-required |
|
/lgtm |
The VRL to_syslog_severity() function is case-sensitive and only accepts lowercase keywords. Causing "Invalid syslog severity value" warnings when users configure capitalized severity keywords like "Informational" or "Critical". Add downcase normalization before the to_syslog_severity() call so case-insensitive keywords are correctly validated without warnings. Fixes: LOG-9609 Signed-off-by: Vitalii Parfonov <vparfono@redhat.com>
|
New changes are detected. LGTM label has been removed. |
|
/hold cancel |
|
@vparfonov: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Description
The VRL
to_syslog_severity()function is case-sensitive and only accepts lowercase keywords, causing spurious "Invalid syslog severity value" warnings when users configure capitalized severity keywords like "Informational" or "Critical".Add downcase normalization before the
to_syslog_severity()call so case-insensitive keywords are correctly validated without warnings./cc @Clee2691
/assign @jcantrill
Links
Summary by CodeRabbit
Bug Fixes
Tests
<PRI>prefixes and asserting no “Invalid syslog severity” or VRL compilation warnings.