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

During a Hot Reload: Parsers referenced by Parsers_File are not loaded if they are specified with a relative path.

Open securitym0nkey opened this issue 1 year ago • 1 comments

Bug Report

Describe the bug

When doing a hot reload Parsers_File will not be loaded if they are a relative path.

To Reproduce

  • Steps to reproduce the problem:

Run following config and send a SIGHUP signal

[SERVICE]

   #Flush every 1 sec - during debugging that's fine
   Flush 1

   # Dont run as daemon
   Daemon Off 

   #log level
   Log_Level debug

   #Parsers
   Parsers_File parsers.conf

   #Hot reload
   Hot_Reload On

[INPUT] 
   Name stdin
   Tag stdin
   Parser nginx

#Flood out to console for debugging
[OUTPUT]
   Name stdout
   Match *

Reload fails and fluent-bit exits:

.
.
.
[2024/02/19 11:33:10] [ info] [output:stdout:stdout.0] worker #0 started
[2024/02/19 11:33:26] [engine] caught signal (SIGHUP)
.
.
.
[2024/02/19 11:33:27] [error] failed initialize input stdin.0
[2024/02/19 11:33:27] [error] [engine] input initialization failed
[2024/02/19 11:33:27] [error] [lib] backend failed
[2024/02/19 11:33:28] [error] [reload] loaded configuration contains error(s). Reloading is aborted
reloading is aborted and exit

Full Output

When using an absolute path for Parser_File like Parsers_File /fluent-bit/etc/parsers.conf the reload works fine.

I believe the bug originates somewhere in the function https://github.com/fluent/fluent-bit/blob/7bcefbb2646131c29a52810f1410cdd20c8db880/src/flb_reload.c#L373

From my understanding new_config->config_path of https://github.com/fluent/fluent-bit/blob/7bcefbb2646131c29a52810f1410cdd20c8db880/src/flb_reload.c#L438 is never set and therefore https://github.com/fluent/fluent-bit/blob/7bcefbb2646131c29a52810f1410cdd20c8db880/src/flb_parser.c#L901 will fail to find and load the parsers file.

Expected behavior Reloads Parsers and continues running with new config.

Your Environment

  • Version used: 2.2.2 container image
  • Configuration: see above
  • Environment name and version (e.g. Kubernetes? What version?): reproduced and debugged with docker - but occurred also in other environments
  • Server type and version: n/a
  • Operating System and version: n/a
  • Filters and plugins: n/a

Additional context

securitym0nkey avatar Feb 19 '24 12:02 securitym0nkey

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 May 21 '24 01:05 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar Jun 08 '24 01:06 github-actions[bot]