Fluent-bit Variables in Key configuration

  docker, environment-variables, fluent-bit

I’m creating a custom Fluent-Bit image and I want a "generic" configuration file that can work on multiple cases, i.e.: it should work with a forward input sometimes and with tail input some other times.

I thought about using environment variables so to only have one input but it seems we cannot set variables in the key part only on the value side (see following code).

When I set the corresponding environment variables in a docker-entrypoint file with corresponding conditions

export INPUT_PATH="/myLogPath"
export INPUT_PATH_TYPE="path"
export INPUT_NAME="tail"
[INPUT]
    Name ${INPUT_NAME}
    ${INPUT_PATH_TYPE} ${INPUT_PATH}

This is the error message I got

[error] [config] tail: unknown configuration property '${INPUT_PATH_TYPE}'. The following properties are allowed: path, exclude_path, key, read_from_head, refresh_interval, watcher_interval, rotate_wait, docker_mode, docker_mode_flush, docker_mode_parser, path_key, ignore_older, buffer_chunk_size, buffer_max_size, skip_long_lines, exit_on_eof, parser, tag_regex, db, db.sync, db.locking, multiline, multiline_flush, parser_firstline, and parser_.

I’m looking for a way to make it dynamic so either to have a single file with dynamic configuration or multiple files which can be included dynamically (@Include requires a static filepath from what I’ve seen).

EDIT: the only option I see is to have multiple input files (for each use case) and call it dynamically when starting fluent-bit in the docker-entrypoint file

Source: Docker Questions

LEAVE A COMMENT