in_tcp/in_udp: Added unparsed log message in tcp_conn.c and udp_conn.c#12059
in_tcp/in_udp: Added unparsed log message in tcp_conn.c and udp_conn.c#12059virys99 wants to merge 3 commits into
Conversation
Signed-off-by: virys99 <142725778+virys99@users.noreply.github.com>
📝 WalkthroughWalkthroughTCP and UDP inbound payload parser-failure paths now emit an additional debug log with the unparsed message content before continuing fallback handling. ChangesParser failure debug logging
Estimated code review effort: 1 (Trivial) | ~2 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 09828a6cc1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| else { | ||
| flb_plg_debug(ctx->ins, "parser '%s' failed on incoming data", | ||
| ctx->parser_name); | ||
| flb_plg_debug(ctx->ins, "unparsed log message: %.*s", len, buf); |
There was a problem hiding this comment.
Cast the precision argument before logging
On parser failures this passes len as the precision for %.*s, but len is a size_t while printf precision requires an int; with the variadic flb_plg_debug call this is undefined behavior and can truncate or misinterpret large TCP records, potentially logging past the intended message. Bound the length and pass an int precision, as other callers in this tree do.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@plugins/in_tcp/tcp_conn.c`:
- Line 309: The debug log in tcp_conn.c uses %.*s with len as the precision, but
that value is a size_t and must be passed as an int for the variadic format to
match. Update the flb_plg_debug call in the unparsed log message path to cast
len to int so the formatting in this branch is type-correct and safe.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
Signed-off-by: virys99 <142725778+virys99@users.noreply.github.com>
Signed-off-by: virys99 <142725778+virys99@users.noreply.github.com>
Added unparsed message print to log file for in_tcp plugin.
Unfortunately, I don't know C.
I have gave a shot add this feature by myself.
Enter
[N/A]in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-testlabel to test for all targets (requires maintainer to do).Documentation
Backporting
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.
Summary by CodeRabbit