Skip to content

Conversation

@jqcorreia
Copy link

@jqcorreia jqcorreia commented Dec 22, 2025

Implement --no-banner command line argument in order to disable version banner printing altogether.

This PR adds a new config flag that disables the version banner but preserves the normal logging mechanism.
Using FluentBit in the context of a service sidecar with frequent service rotation, the version banner adds a non-negligent amount of log data to be consumed. Additionally, the MOTD is not indexed correctly and pollutes the log stream of FluentBit itself.

Having this flag will enable users to preserve needed logging but avoid the overhead of the version banner.


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:

  • [N/A] Example configuration file for the change
  • Debug log output from testing the change
  • [N/A] 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.

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

Documentation

  • [N/A] Documentation required for this feature

Backporting

  • [N/A] 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

  • New Features
    • Added a command-line option to suppress the version banner at startup (-B/--no-banner).
    • Version banner is enabled by default; use the new option to disable it.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 22, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Adds a new banner flag to the configuration (default ON) and a CLI switch -B/--no-banner to suppress the startup version banner; initialization and banner display logic were updated accordingly.

Changes

Cohort / File(s) Summary
Config structure definition
include/fluent-bit/flb_config.h
Added int banner; to struct flb_config to store banner display state
Config initialization
src/flb_config.c
Initialized config->banner = FLB_TRUE in flb_config_init
CLI option handling and banner logic
src/fluent-bit.c
Added -B/--no-banner option (long option "no-banner"), updated getopt string, set config->banner = FLB_FALSE when used, and changed banner display conditional to check config->banner alongside verbose

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify correct placement and initialization of the new struct field.
  • Confirm getopt_long entry, option character mapping, and help text.
  • Check banner display conditional and no unintended side effects.

Suggested reviewers

  • cosmo0920

Poem

🐰 I tuck the banner under paw so neat,
A gentle hop, a quieter greet,
With -B I hush the startup song,
The log stays calm, the day moves on,
A rabbit nods — the change is sweet.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding support for the --no-banner command-line argument to disable the version banner at startup.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 50baf4c and d98b068.

📒 Files selected for processing (3)
  • include/fluent-bit/flb_config.h
  • src/flb_config.c
  • src/fluent-bit.c
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/flb_config.c
  • include/fluent-bit/flb_config.h
  • src/fluent-bit.c

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 and usage tips.

Copy link

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

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.

ℹ️ 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".

src/fluent-bit.c Outdated
Comment on lines 1129 to 1130
"b:c:dDf:C:i:m:M:o:R:r:F:p:e:"
"t:T:l:vw:qVhJL:HP:s:SWYZ",
"t:T:l:v:Bw:qVhJL:HP:s:SWYZ",

Choose a reason for hiding this comment

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

P1 Badge Fix getopt string so -v stays argument-free

The updated short options string now has v: because the new B flag was inserted as v:B. In getopt_long, a colon after a flag means it requires an argument, so -v will start consuming the next token (or error if it is last), breaking the existing verbosity flag. This will affect any invocation that uses -v without an argument (the documented/expected usage). The short option string should list B without introducing v: (e.g., ...l:vBw:...).

Useful? React with 👍 / 👎.

@jqcorreia
Copy link
Author

Startup log with and without --no-banner

bin/fluent-bit
Fluent Bit v4.2.2
* Copyright (C) 2015-2025 The Fluent Bit Authors
* Fluent Bit is a CNCF graduated project under the Fluent organization
* https://fluentbit.io

______ _                  _    ______ _ _             ___   _____
|  ___| |                | |   | ___ (_) |           /   | / __  \
| |_  | |_   _  ___ _ __ | |_  | |_/ /_| |_  __   __/ /| | `' / /'
|  _| | | | | |/ _ \ '_ \| __| | ___ \ | __| \ \ / / /_| |   / /
| |   | | |_| |  __/ | | | |_  | |_/ / | |_   \ V /\___  |_./ /___
\_|   |_|\__,_|\___|_| |_|\__| \____/|_|\__|   \_/     |_(_)_____/

             Fluent Bit v4.2 – Direct Routes Ahead
         Celebrating 10 Years of Open, Fluent Innovation!

[2025/12/22 15:51:14.423653963] [ info] [fluent bit] version=4.2.2, commit=50baf4cd5a, pid=1542598
[2025/12/22 15:51:14.423717224] [ info] [storage] ver=1.5.4, type=memory, sync=normal, checksum=off, max_chunks_up=128
[2025/12/22 15:51:14.423724934] [ info] [simd    ] disabled
[2025/12/22 15:51:14.423727254] [ info] [cmetrics] version=1.0.5
[2025/12/22 15:51:14.423734044] [ info] [ctraces ] version=0.6.6
[2025/12/22 15:51:14.423771995] [ info] [sp] stream processor started
[2025/12/22 15:51:14.423795135] [ info] [engine] Shutdown Grace Period=5, Shutdown Input Grace Period=2
bin/fluent-bit --no-banner
[2025/12/22 15:51:45.399790875] [ info] [fluent bit] version=4.2.2, commit=50baf4cd5a, pid=1542668
[2025/12/22 15:51:45.399858415] [ info] [storage] ver=1.5.4, type=memory, sync=normal, checksum=off, max_chunks_up=128
[2025/12/22 15:51:45.399866736] [ info] [simd    ] disabled
[2025/12/22 15:51:45.399873086] [ info] [cmetrics] version=1.0.5
[2025/12/22 15:51:45.399879256] [ info] [ctraces ] version=0.6.6
[2025/12/22 15:51:45.399928006] [ info] [sp] stream processor started
[2025/12/22 15:51:45.399951177] [ info] [engine] Shutdown Grace Period=5, Shutdown Input Grace Period=2

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b9f26a9 and 50baf4c.

📒 Files selected for processing (3)
  • include/fluent-bit/flb_config.h
  • src/flb_config.c
  • src/fluent-bit.c
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-11-21T06:23:29.770Z
Learnt from: cosmo0920
Repo: fluent/fluent-bit PR: 11171
File: include/fluent-bit/flb_lib.h:52-53
Timestamp: 2025-11-21T06:23:29.770Z
Learning: In Fluent Bit core (fluent/fluent-bit repository), function descriptions/documentation are not required for newly added functions in header files.

Applied to files:

  • src/fluent-bit.c
  • include/fluent-bit/flb_config.h
📚 Learning: 2025-08-31T12:46:11.940Z
Learnt from: ThomasDevoogdt
Repo: fluent/fluent-bit PR: 9277
File: .github/workflows/pr-compile-check.yaml:147-151
Timestamp: 2025-08-31T12:46:11.940Z
Learning: In fluent-bit CMakeLists.txt, the system library preference flags are defined as FLB_PREFER_SYSTEM_LIB_ZSTD and FLB_PREFER_SYSTEM_LIB_KAFKA with the FLB_ prefix.

Applied to files:

  • include/fluent-bit/flb_config.h
🔇 Additional comments (7)
src/flb_config.c (1)

277-277: LGTM! Initialization is correct.

The banner field is properly initialized to FLB_TRUE, making the banner display the default behavior. The placement after verbose and before grace is logical and consistent with the struct definition order.

include/fluent-bit/flb_config.h (1)

81-83: LGTM! Field declaration is well-placed and documented.

The new banner field is appropriately positioned in the struct after verbose and the comment clearly indicates the default behavior. The int type is consistent with other boolean-like configuration flags in the codebase.

src/fluent-bit.c (5)

173-173: LGTM! Help text is clear and descriptive.

The help text clearly describes the flag's purpose. The capitalization is consistent with other help text entries in the file.


1072-1072: LGTM! Long option definition is correct.

The --no-banner option is properly defined with no_argument and correctly maps to the short option 'B'.


1130-1130: LGTM! Option character correctly added to getopt string.

The 'B' character is properly added without a colon, correctly indicating that --no-banner takes no argument.


1289-1291: LGTM! Flag handler is correctly implemented.

The case handler properly sets config->banner to FLB_FALSE when the -B flag is encountered, following the same pattern as other boolean flags in the codebase.


1289-1291: Verify: Is command-line-only control sufficient?

The banner flag is not exposed in the service_configs array in src/flb_config.c, meaning it cannot be controlled via configuration files—only through the command-line flag.

Given the PR's use case (service sidecars with frequent rotation), command-line control is likely sufficient. However, please confirm this is intentional and whether config file support might be needed for other deployment scenarios.

Comment on lines +1349 to 1352
/* Show banner only if the configuration explicitly says so */
if (config->verbose != FLB_LOG_OFF && config->banner == FLB_TRUE) {
flb_version_banner();
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Update misleading comment.

The logic is correct, but the comment is misleading. It states "only if the configuration explicitly says so", but the banner is actually shown by default unless explicitly disabled via -B or quiet mode (-q).

The comment should reflect that the banner is the default behavior, not an opt-in feature.

🔎 Suggested comment correction
-    /* Show banner only if the configuration explicitly says so */
+    /* Show banner unless disabled via --no-banner or quiet mode */
     if (config->verbose != FLB_LOG_OFF && config->banner == FLB_TRUE) {
         flb_version_banner();
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/* Show banner only if the configuration explicitly says so */
if (config->verbose != FLB_LOG_OFF && config->banner == FLB_TRUE) {
flb_version_banner();
}
/* Show banner unless disabled via --no-banner or quiet mode */
if (config->verbose != FLB_LOG_OFF && config->banner == FLB_TRUE) {
flb_version_banner();
}
🤖 Prompt for AI Agents
In src/fluent-bit.c around lines 1349 to 1352, the existing comment "Show banner
only if the configuration explicitly says so" is misleading because the banner
is shown by default unless disabled with -B or quiet mode; update the comment to
state that the banner is displayed by default and will be suppressed only when
config->banner is false or verbose is set to FLB_LOG_OFF (e.g., via -B or -q),
so the comment accurately reflects default behavior and suppression conditions.

Implement --no-banner command line argument in order to
disable version banner printing altogether.

Signed-off-by: José Quadrado <[email protected]>
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.

1 participant