Skip to content

Conversation

@ahayworth
Copy link

@ahayworth ahayworth commented Oct 31, 2025

There are certain kinds of invalid configurations that pass the
--dry-run check, but fail to start at run time. This commit addresses
the issue by re-using some of the hot reload validation logic.

For example, this config is trivially invalid, passes --dry-run, and
fails at runtime:

pipeline:
  inputs:
  - name: dummy
    tag: test
    invalid_property_that_does_not_exist: some_value
  outputs:
  - name: stdout
    match: '*'
zsh ❮ fluent-bit --dry-run -c ~/tmp/fbconfig-bad-property.yaml
Fluent Bit v4.1.1
* Copyright (C) 2015-2025 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

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

configuration test is successful

zsh ❮ fluent-bit -c ~/tmp/fbconfig-bad-property.yaml
Fluent Bit v4.1.1
* Copyright (C) 2015-2025 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

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

[2025/10/31 16:05:55.268532000] [ info] [fluent bit] version=4.1.1, commit=, pid=21037
[2025/10/31 16:05:55.268808000] [ info] [storage] ver=1.5.3, type=memory, sync=normal, checksum=off, max_chunks_up=128
[2025/10/31 16:05:55.269140000] [ info] [simd    ] disabled
[2025/10/31 16:05:55.269147000] [ info] [cmetrics] version=1.0.5
[2025/10/31 16:05:55.269407000] [ info] [ctraces ] version=0.6.6
[2025/10/31 16:05:55.269476000] [error] [config] dummy: unknown configuration property 'invalid_property_that_does_not_exist'. The following properties are allowed: samples, dummy, metadata, rate, interval_sec, interval_nsec, copies, start_time_sec, start_time_nsec, fixed_timestamp, flush_on_startup, and test_hang_on_exit.
[2025/10/31 16:05:55.269486000] [ help] try the command: fluent-bit -i dummy -h

[2025/10/31 16:05:55.269515000] [error] [engine] input initialization failed

With this commit, we can see that the additional validation from hot
reload catches the error right away:

zsh ❯ bin/fluent-bit --dry-run -c ~/tmp/fbconfig-bad-property.yaml
Fluent Bit v4.2.0
* Copyright (C) 2015-2025 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

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

[2025/10/31 16:07:50.402568000] [error] [config] dummy: unknown configuration property 'invalid_property_that_does_not_exist'. The following properties are allowed: samples, dummy, metadata, rate, interval_sec, interval_nsec, copies, start_time_sec, start_time_nsec, fixed_timestamp, flush_on_startup, and test_hang_on_exit.
[2025/10/31 16:07:50.402792000] [ help] try the command: bin/fluent-bit -i dummy -h

[2025/10/31 16:07:50.402800000] [error] [reload] check properties for input plugins is failed

(The logs of course now say [reload], which is a little misleading...
we can clean that up, if desired).


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 (included in the commit/PR description)
  • Debug log output from testing the change (included in the commit/PR description)
  • 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

  • Bug Fixes

    • Dry-run now performs explicit configuration validation before exit, always runs cleanup, and returns failure when unknown or invalid config properties are detected, providing clearer failure signals during config testing.
  • Tests

    • Added an automated test that verifies dry-run fails for invalid configuration properties and reports the unknown-property and validation failure messages.

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

@coderabbitai
Copy link

coderabbitai bot commented Oct 31, 2025

Walkthrough

In --dry-run mode, fluent-bit now calls flb_reload_property_check_all(config) before cleanup, stores its return value, always performs cleanup, and exits non-zero on validation failure or prints a success message and exits normally on success.

Changes

Cohort / File(s) Change Summary
Dry-run validation logic
src/fluent-bit.c
Call flb_reload_property_check_all(config) in the --dry-run path, capture its return value, always run cleanup (destroy config/options/context), and exit non-zero on validation failure or print success and exit normally on success.
New dry-run invalid-property test
tests/runtime_shell/dry_run_invalid_property.sh
Added a shell test that writes a temp YAML with an invalid property, runs fluent-bit with --dry-run, asserts a non-zero exit code, checks for unknown-property and reload-validation failure messages, and cleans up temporary files.
Test inclusion
tests/runtime_shell/CMakeLists.txt
Added dry_run_invalid_property.sh to UNIT_TESTS_SH so the new test is discovered and executed by the test harness.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant FB as "fluent-bit (--dry-run)"
    participant Validator as "flb_reload_property_check_all"

    User->>FB: Start fluent-bit with --dry-run
    Note over FB: Parse config, init env/options/context
    FB->>Validator: flb_reload_property_check_all(config)
    alt Validator returns non-zero
        Validator-->>FB: non-zero (validation failure)
        Note over FB: Perform cleanup (destroy config/options/context)
        FB-->>User: Exit non-zero (print validation failure)
    else Validator returns zero
        Validator-->>FB: zero (validation success)
        Note over FB: Perform cleanup (destroy config/options/context)
        FB-->>User: Print "configuration test succeeded" and exit zero
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Pay attention to:
    • Correct propagation of the validation return value after cleanup.
    • Any side effects or resource lifetime implications of calling flb_reload_property_check_all() before teardown.
    • Robustness of the new shell test (temporary file handling and message matching).

Suggested reviewers

  • edsiper
  • koleini
  • fujimotos

Poem

🐰 I hop through configs, sniff each YAML line,

I flag the odd property, then tidy the mine.
I clean every burrow, leave no stray byte,
If something's awry I thump — if not, all's right. 🥕

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 'bin: run additional validation for --dry-run' directly and clearly describes the main change: adding validation logic to the --dry-run feature to catch invalid configurations earlier.
✨ 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: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9ef91de and 31924ee.

📒 Files selected for processing (3)
  • src/fluent-bit.c (1 hunks)
  • tests/runtime_shell/CMakeLists.txt (1 hunks)
  • tests/runtime_shell/dry_run_invalid_property.sh (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • tests/runtime_shell/CMakeLists.txt
  • tests/runtime_shell/dry_run_invalid_property.sh
  • src/fluent-bit.c

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


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

@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: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 93d3fb3 and 57442a0.

📒 Files selected for processing (1)
  • src/fluent-bit.c (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/fluent-bit.c (1)
src/flb_reload.c (1)
  • flb_reload_property_check_all (208-245)

@edsiper
Copy link
Member

edsiper commented Nov 1, 2025

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@cosmo0920
Copy link
Contributor

Hi, could you rebase off master?
After rebasing off the current master, I can confirm like as a below even if on macOS:

% bin/fluent-bit -c  invalid_config.yaml --dry-run
Fluent Bit v4.2.0
* Copyright (C) 2015-2025 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

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


[2025/11/07 15:17:51.675942000] [ info] Configuration:
[2025/11/07 15:17:51.675948000] [ info]  flush time     | 1.000000 seconds
[2025/11/07 15:17:51.675952000] [ info]  grace          | 5 seconds
[2025/11/07 15:17:51.675954000] [ info]  daemon         | 0
[2025/11/07 15:17:51.675955000] [ info] ___________
[2025/11/07 15:17:51.675957000] [ info]  inputs:
[2025/11/07 15:17:51.675959000] [ info]      dummy
[2025/11/07 15:17:51.675960000] [ info] ___________
[2025/11/07 15:17:51.675962000] [ info]  filters:
[2025/11/07 15:17:51.675963000] [ info] ___________
[2025/11/07 15:17:51.675965000] [ info]  outputs:
[2025/11/07 15:17:51.675966000] [ info]      stdout.0
[2025/11/07 15:17:51.675968000] [ info] ___________
[2025/11/07 15:17:51.675969000] [ info]  collectors:
[2025/11/07 15:17:51.675986000] [error] [config] dummy: unknown configuration property 'invalid_property_that_does_not_exist'. The following properties are allowed: samples, dummy, metadata, rate, interval_sec, interval_nsec, copies, start_time_sec, start_time_nsec, fixed_timestamp, flush_on_startup, and test_hang_on_exit.
[2025/11/07 15:17:51.675991000] [ help] try the command: bin/fluent-bit -i dummy -h

[2025/11/07 15:17:51.675994000] [error] [reload] check properties for input plugins is failed

Copy link
Contributor

@cosmo0920 cosmo0920 left a comment

Choose a reason for hiding this comment

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

Patch is good but it needs to be rebased off master.

Copy link
Collaborator

@patrick-stephens patrick-stephens left a comment

Choose a reason for hiding this comment

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

I would expect some tests as well to validate this to ensure we do not regress in the future as well.

@ahayworth ahayworth force-pushed the ahayworth/sc-149733/additional-dry-run-validation branch 2 times, most recently from 1a9755a to d180b19 Compare November 10, 2025 15:36
@ahayworth
Copy link
Author

@patrick-stephens @cosmo0920 I've rebased and added a test - I'm not sure how extensive we'd like test coverage to be here, but if needed I can add additional cases.

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: 0

🧹 Nitpick comments (3)
src/fluent-bit.c (1)

1438-1451: Cleanup logic now correctly handles both success and failure paths.

The updated implementation properly addresses the resource leak issue raised in the previous review. Resources (cf_opts and ctx) are now cleaned up before exiting in both the success and failure cases, which prevents resource leaks during dry-run validation.

The flow is clear:

  1. Validate configuration
  2. Always perform cleanup
  3. Exit based on validation result

Minor: Comment placement could be more precise.

The comment on line 1441 states "config test is done" but appears before the validation result is checked (lines 1446-1448). Consider moving this comment to line 1439 or rephrasing it to be more precise about the sequence of operations.

tests/runtime_shell/dry_run_invalid_property.sh (2)

11-24: Consider using unique temporary file names.

The test uses a hardcoded path /tmp/dry_run_invalid_property.yaml which could cause conflicts if multiple test instances run in parallel. Consider using mktemp to generate unique temporary file names:

-cat > /tmp/dry_run_invalid_property.yaml << EOL
+TEMP_CONFIG=$(mktemp /tmp/dry_run_invalid_property_XXXXXX.yaml)
+cat > $TEMP_CONFIG << EOL

Then reference $TEMP_CONFIG throughout the script and update the cleanup accordingly.


30-32: Same consideration applies to output file.

The output file also uses a hardcoded path. If you adopt mktemp for the config file (as suggested above), apply the same pattern here:

-OUTPUT_FILE="/tmp/dry_run_invalid_property_output.txt"
+OUTPUT_FILE=$(mktemp /tmp/dry_run_invalid_property_output_XXXXXX.txt)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 538df01 and d180b19.

📒 Files selected for processing (2)
  • src/fluent-bit.c (1 hunks)
  • tests/runtime_shell/dry_run_invalid_property.sh (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/fluent-bit.c (3)
src/flb_reload.c (1)
  • flb_reload_property_check_all (208-245)
src/flb_lib.c (2)
  • flb_init_env (128-141)
  • flb_destroy (228-263)
src/config_format/flb_config_format.c (1)
  • flb_cf_destroy (151-157)
🔇 Additional comments (2)
tests/runtime_shell/dry_run_invalid_property.sh (2)

1-10: LGTM! Environment setup follows good practices.

The environment variable handling with fallback defaults is robust and follows common patterns for shell test scripts. The echo statement on line 9 aids in debugging and test transparency.


42-64: LGTM! Comprehensive validation and proper cleanup.

The test correctly validates all three expected behaviors:

  1. Non-zero exit code from dry-run
  2. Error message about the unknown property
  3. Reload validation failure message

The use of || true on lines 43-44 prevents grep failures from prematurely terminating the script, and the cleanup (lines 47-49) ensures temporary files are removed before the final exit. The detailed diagnostic output on failure (lines 60-62) will aid in debugging test failures.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you just confirm this actually runs in CI @ahayworth ?

Copy link
Author

@ahayworth ahayworth Nov 10, 2025

Choose a reason for hiding this comment

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

🤦 I did forget to add the test to the list to run, and added that here: 8180652

I'm not 100% sure which CI job would actually run those tests, though.

Copy link
Contributor

Choose a reason for hiding this comment

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

I approved to run CI tests. Waiting for the results.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks - looks like CI has passed, but I am not sure which of the matrix jobs actually runs the test to double-check it.

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: 0

🧹 Nitpick comments (4)
tests/runtime_shell/dry_run_invalid_property.sh (4)

4-7: Consider adding validation for FLB_BIN existence.

The script assumes $FLB_BIN points to a valid executable but doesn't verify this before use (line 32). Consider adding a check after line 7:

 fi
+
+if [ ! -x "$FLB_BIN" ]; then
+    echo "Error: Fluent Bit binary not found or not executable at: $FLB_BIN"
+    exit 1
+fi

This would provide clearer error messages if the binary path is incorrect.


12-24: Consider using mktemp for safer temporary file creation.

The script uses hardcoded paths in /tmp which can lead to race conditions in concurrent test runs or permission issues in some environments.

-cat > /tmp/dry_run_invalid_property.yaml << EOL
+CONFIG_FILE=$(mktemp /tmp/dry_run_invalid_property.XXXXXX.yaml)
+cat > "$CONFIG_FILE" << EOL

Then update references throughout the script to use $CONFIG_FILE instead of the hardcoded path.


32-32: Consider using mktemp for the output file as well.

Similar to the config file, the output file path is hardcoded. For line 31-32:

-OUTPUT_FILE="/tmp/dry_run_invalid_property_output.txt"
+OUTPUT_FILE=$(mktemp /tmp/dry_run_invalid_property_output.XXXXXX.txt)
 $FLB_BIN --dry-run -c /tmp/dry_run_invalid_property.yaml > $OUTPUT_FILE 2>&1

46-49: Early cleanup may hinder debugging test failures.

The temporary files are removed (lines 48-49) before the test validation completes (lines 55-64). If the test fails, developers won't be able to inspect the config or output files for debugging. Consider moving the cleanup to after line 64, or conditionally preserving files on failure:

+# Clean up only on success
 if [ "$EXIT_CODE" -ne 0 ] && [ "$UNKNOWN_PROPERTY" -gt 0 ] && [ "$RELOAD_ERROR" -gt 0 ]; then
     echo "Test passed: Fluent Bit --dry-run correctly detected invalid property and failed"
+    rm -f /tmp/dry_run_invalid_property.yaml
+    rm -f $OUTPUT_FILE
     exit 0
 else
     echo "Test failed: Fluent Bit --dry-run should detect invalid properties and fail"
     echo "Exit code: $EXIT_CODE (expected non-zero)"
     echo "Unknown property message count: $UNKNOWN_PROPERTY (expected > 0)"
     echo "Reload error message count: $RELOAD_ERROR (expected > 0)"
+    echo "Config and output files preserved for debugging"
     exit 1
 fi
-
-# Clean up
-echo "Cleaning up..."
-rm -f /tmp/dry_run_invalid_property.yaml
-rm -f $OUTPUT_FILE
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8180652 and 9ef91de.

📒 Files selected for processing (3)
  • src/fluent-bit.c (1 hunks)
  • tests/runtime_shell/CMakeLists.txt (1 hunks)
  • tests/runtime_shell/dry_run_invalid_property.sh (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/runtime_shell/CMakeLists.txt
🧰 Additional context used
🧬 Code graph analysis (1)
src/fluent-bit.c (3)
src/flb_reload.c (1)
  • flb_reload_property_check_all (208-245)
src/flb_lib.c (2)
  • flb_init_env (128-141)
  • flb_destroy (228-263)
src/config_format/flb_config_format.c (1)
  • flb_cf_destroy (151-157)
🔇 Additional comments (2)
src/fluent-bit.c (1)

1438-1451: LGTM! The dry-run validation logic is well-structured.

The implementation correctly validates properties using flb_reload_property_check_all, performs cleanup regardless of the validation result, and exits with the appropriate status code. The cleanup sequence (init_env → destroy cf_opts → destroy ctx) ensures resources are properly released in both success and failure paths.

Note: The [reload] prefix in error messages (from flb_reload_property_check_all at src/flb_reload.c:207-244) may be slightly misleading in a dry-run context, but this is already acknowledged in the PR description and can be addressed in a follow-up if needed.

tests/runtime_shell/dry_run_invalid_property.sh (1)

55-64: Test validation logic looks solid.

The test correctly validates all three expected conditions:

  1. Non-zero exit code (validation should fail)
  2. Error message about the unknown property
  3. Error message from reload validation

This comprehensive checking ensures the new dry-run validation behavior is working as intended.

@cosmo0920
Copy link
Contributor

cosmo0920 commented Nov 19, 2025

@ahayworth Could you rebase off master? I fixed CI issue by no left device space. So, we need to confirm that all of CI tasks is green.

There are certain kinds of invalid configurations that pass the
`--dry-run` check, but fail to start at run time. This commit addresses
the issue by re-using some of the hot reload validation logic.

For example, this config is trivially invalid, passes `--dry-run`, and
fails at runtime:

```
pipeline:
  inputs:
  - name: dummy
    tag: test
    invalid_property_that_does_not_exist: some_value
  outputs:
  - name: stdout
    match: '*'
```

```
zsh ❮ fluent-bit --dry-run -c ~/tmp/fbconfig-bad-property.yaml
Fluent Bit v4.1.1
* Copyright (C) 2015-2025 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

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

configuration test is successful

zsh ❮ fluent-bit -c ~/tmp/fbconfig-bad-property.yaml
Fluent Bit v4.1.1
* Copyright (C) 2015-2025 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

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

[2025/10/31 16:05:55.268532000] [ info] [fluent bit] version=4.1.1, commit=, pid=21037
[2025/10/31 16:05:55.268808000] [ info] [storage] ver=1.5.3, type=memory, sync=normal, checksum=off, max_chunks_up=128
[2025/10/31 16:05:55.269140000] [ info] [simd    ] disabled
[2025/10/31 16:05:55.269147000] [ info] [cmetrics] version=1.0.5
[2025/10/31 16:05:55.269407000] [ info] [ctraces ] version=0.6.6
[2025/10/31 16:05:55.269476000] [error] [config] dummy: unknown configuration property 'invalid_property_that_does_not_exist'. The following properties are allowed: samples, dummy, metadata, rate, interval_sec, interval_nsec, copies, start_time_sec, start_time_nsec, fixed_timestamp, flush_on_startup, and test_hang_on_exit.
[2025/10/31 16:05:55.269486000] [ help] try the command: fluent-bit -i dummy -h

[2025/10/31 16:05:55.269515000] [error] [engine] input initialization failed
```

With this commit, we can see that the additional validation from hot
reload catches the error right away:

```
zsh ❯ bin/fluent-bit --dry-run -c ~/tmp/fbconfig-bad-property.yaml
Fluent Bit v4.2.0
* Copyright (C) 2015-2025 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

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

[2025/10/31 16:07:50.402568000] [error] [config] dummy: unknown configuration property 'invalid_property_that_does_not_exist'. The following properties are allowed: samples, dummy, metadata, rate, interval_sec, interval_nsec, copies, start_time_sec, start_time_nsec, fixed_timestamp, flush_on_startup, and test_hang_on_exit.
[2025/10/31 16:07:50.402792000] [ help] try the command: bin/fluent-bit -i dummy -h

[2025/10/31 16:07:50.402800000] [error] [reload] check properties for input plugins is failed
```

(The logs of course now say `[reload]`, which is a little misleading...
we can clean that up, if desired).

Signed-off-by: Andrew Hayworth <[email protected]>
We need to perform the same partial initialization and releasing of
resources whether or not the dry-run was successful, so this commit
ensures that we call those functions before exiting either way.

Signed-off-by: Andrew Hayworth <[email protected]>
This adds a runtime_shell test that runs fluent-bit in dry-run mode and
ensures we are running the additional validation recently added.
Specifically, we test that configuration property validation is
happening, which is borrowed from the hot reload code and was not
previously used for dry-run validation.

Signed-off-by: Andrew Hayworth <[email protected]>
This was an oversight on my part - we actually need to list this as a
test for it to be run.

Signed-off-by: Andrew Hayworth <[email protected]>
@ahayworth ahayworth force-pushed the ahayworth/sc-149733/additional-dry-run-validation branch from 9ef91de to 31924ee Compare November 20, 2025 13:28
@ahayworth
Copy link
Author

@cosmo0920 Absolutely, rebased!

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.

4 participants