Skip to content

in_tcp/in_udp: Added unparsed log message in tcp_conn.c and udp_conn.c#12059

Open
virys99 wants to merge 3 commits into
fluent:masterfrom
virys99:master
Open

in_tcp/in_udp: Added unparsed log message in tcp_conn.c and udp_conn.c#12059
virys99 wants to merge 3 commits into
fluent:masterfrom
virys99:master

Conversation

@virys99

@virys99 virys99 commented Jul 6, 2026

Copy link
Copy Markdown

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:

  • Example configuration file for the change
  • Debug log output from testing the change
  • Attached Valgrind output that shows no leaks or memory corruption was found

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • Run local packaging test showing all targets (including any new ones) build.
  • Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • Documentation required for this feature

Backporting

  • Backport to latest stable release.

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

  • Bug Fixes
    • Added more detailed debug logging when incoming payload parsing fails, including the unparsed message content (bounded by the received length) to help diagnose issues more easily.

Signed-off-by: virys99 <142725778+virys99@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

TCP and UDP inbound payload parser-failure paths now emit an additional debug log with the unparsed message content before continuing fallback handling.

Changes

Parser failure debug logging

Layer / File(s) Summary
Log unparsed payload bytes
plugins/in_tcp/tcp_conn.c, plugins/in_udp/udp_conn.c
Adds debug output in TCP and UDP parser-failure branches to print the incoming payload snippet alongside the existing failure handling.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Possibly related PRs

Suggested reviewers: edsiper

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change by mentioning the added unparsed log message handling in both TCP and UDP paths.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread plugins/in_tcp/tcp_conn.c Outdated
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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a2e61b89-16cb-49ce-9f3b-579d014fb7fe

📥 Commits

Reviewing files that changed from the base of the PR and between a1e05fc and 09828a6.

📒 Files selected for processing (1)
  • plugins/in_tcp/tcp_conn.c

Comment thread plugins/in_tcp/tcp_conn.c Outdated
virys99 added 2 commits July 7, 2026 19:52
Signed-off-by: virys99 <142725778+virys99@users.noreply.github.com>
Signed-off-by: virys99 <142725778+virys99@users.noreply.github.com>
@virys99 virys99 changed the title in_tcp: Added unparsed log message in tcp_conn.c in_tcp/in_udp: Added unparsed log message in tcp_conn.c and udp_conn.c Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants