fluent-bit icon indicating copy to clipboard operation
fluent-bit copied to clipboard

Dry run reports success all the time

Open skokhanovskiy opened this issue 3 years ago • 1 comments

Bug Report

Describe the bug Fluent Bit with -D/--dry-run options reports success and exits with zero exit code even if wrong configuration file was passed.

To Reproduce

  1. Create completely wrong configuration file
    $ cat >config <<EOF
    This is [a] completely wrong
    configuration
    [FILE]
    EOF
    
  2. Run Fluent Bit with it
    $ docker run --rm -v "$(pwd)/config:/config" fluent/fluent-bit:1.9.7 --config=/config --dry-run
    

Fluent Bit prints something like

Fluent Bit v1.9.7
* Copyright (C) 2015-2022 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

[2022/08/15 12:19:51] [error] [config] error in /config:1: could not allocate key value pair
configuration test is successful

End exits with zero exit code

$ echo $?
0

Expected behavior

Fluent Bit should print only error message and exit with non-zero exit code.

Fluent Bit v1.9.7
* Copyright (C) 2015-2022 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io

[2022/08/15 12:19:51] [error] [config] error in /config:1: could not allocate key value pair
$ echo $?
1

Your Environment

  • Version used: 1.9.7
  • Configuration: any

skokhanovskiy avatar Aug 15 '22 12:08 skokhanovskiy

Looks to be resolved by @nokute78 #5950 as works with latest master image and does not print the configuration test is successful message.

$ docker run --rm -it -v $PWD/config:/test.conf ghcr.io/fluent/fluent-bit/master:x86_64 -c /test.conf --dry-run
...
Digest: sha256:4966ee0e99d6b547852bc7c028f2b4de92867f5a61cbee7147a9e14708b9f115
Status: Downloaded newer image for ghcr.io/fluent/fluent-bit/master:x86_64
Fluent Bit v2.0.0
* Copyright (C) 2015-2022 The Fluent Bit Authors
* Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
* https://fluentbit.io/

[2022/09/07 19:57:47] [error] [config] error in /test.conf:1: could not allocate key value pair
[2022/09/07 19:57:47] [error] configuration file contains errors, aborting.
$ echo $?
1

patrick-stephens avatar Sep 07 '22 20:09 patrick-stephens

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days. Maintainers can add the exempt-stale label.

github-actions[bot] avatar Aug 14 '23 01:08 github-actions[bot]

Issue resolved.

skokhanovskiy avatar Aug 14 '23 08:08 skokhanovskiy