Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions administration/configuring-fluent-bit/classic-mode/variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ Fluent Bit supports the usage of environment variables in any value associated t

The variables are case sensitive and can be used in the following format:

```text
${MY_VARIABLE}
```
* **Standard:** `${MY_VARIABLE}`
* **With Default Value:** `${MY_VARIABLE:-default_value}` (**v5.0.6+**)

When Fluent Bit starts, the configuration reader will detect any request for `${MY_VARIABLE}` and will try to resolve its value.

Expand All @@ -19,6 +18,18 @@ When Fluent Bit is running under [`systemd`](https://systemd.io/) (using the off

These files are ignored if they don't exist.

### Fallback behavior

{% hint style="info" %}
Minimum Fluent Bit version 5.0.6
{% endhint %}

If the `${VARIABLE:-DEFAULT}` syntax is used, Fluent Bit will use the `DEFAULT` value if the variable meets either of the following conditions:
1. The variable **isn't defined** (unset).
2. The variable is defined but set to an **empty string** (`''`).

Nesting **isn't supported**. You can't use the `${}` syntax within another `${}` definition. `${MY_VAR:-${OTHER_VAR}}` would be invalid.

## Example

Create the following configuration file \(`fluent-bit.conf`\):
Expand Down Expand Up @@ -53,4 +64,4 @@ $ bin/fluent-bit -c fluent-bit.conf

...
[0] cpu.local: [1491243925, {"cpu_p"=>1.750000, "user_p"=>1.750000, "system_p"=>0.000000, "cpu0.p_cpu"=>3.000000, "cpu0.p_user"=>2.000000, "cpu0.p_system"=>1.000000, "cpu1.p_cpu"=>0.000000, "cpu1.p_user"=>0.000000, "cpu1.p_system"=>0.000000, "cpu2.p_cpu"=>4.000000, "cpu2.p_user"=>4.000000, "cpu2.p_system"=>0.000000, "cpu3.p_cpu"=>1.000000, "cpu3.p_user"=>1.000000, "cpu3.p_system"=>0.000000}]
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,22 @@ pipeline:

In this example, `${DB_PASSWORD}` is read from the file `/run/secrets/db_password` and refreshed every 60 seconds. `${REGION}` is set to the static value `us-east-1`.

## Default values

{% hint style="info" %}
Minimum Fluent Bit version 5.0.6
{% endhint %}

Fluent Bit supports setting a default value for an environment variable if the variable isn't defined or is set to an empty string ('').

The syntax for a default value is `${VARIABLE_NAME:-DEFAULT_VALUE}`.

```yaml
service:
flush: ${FLUSH_INTERVAL:-5}
log_level: info
```

Comment thread
benjaminmueggenburg-serato marked this conversation as resolved.
## Predefined variables

Fluent Bit supports the following predefined environment variables. You can reference these variables in configuration files without defining them in the `env` section.
Expand Down
Loading