Skip to content

Commit 57442a0

Browse files
committed
bin: run additional validation for --dry-run
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]>
1 parent f879a93 commit 57442a0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/fluent-bit.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,6 +1430,11 @@ static int flb_main_run(int argc, char **argv)
14301430
#endif
14311431

14321432
if (config->dry_run == FLB_TRUE) {
1433+
ret = flb_reload_property_check_all(config);
1434+
if (ret != 0) {
1435+
exit(EXIT_FAILURE);
1436+
}
1437+
14331438
fprintf(stderr, "configuration test is successful\n");
14341439
flb_init_env();
14351440
flb_cf_destroy(cf_opts);

0 commit comments

Comments
 (0)