You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: administration: yaml: document extended env list form
- Add map form and extended list form headings to organize existing and new content
- Document extended list form properties: name, value, uri, and refresh_interval
- Add YAML example showing file-backed secrets with automatic refresh
- Explain runtime refresh behavior for file:// URI-backed variables
This update for code commits without supporting docs PR.
Signed-off-by: Eric D. Schabell <eric@schabell.org>
Copy file name to clipboardExpand all lines: administration/configuring-fluent-bit/yaml/environment-variables-section.md
+44-2Lines changed: 44 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,12 @@
1
1
# Environment variables
2
2
3
-
The `env` section of YAML configuration files lets you define environment variables. These variables can then be used to dynamically replace values throughout your configuration using the `${VARIABLE_NAME}` syntax.
3
+
The `env` section of YAML configuration files lets you define environment variables. These variables can then be used to dynamically replace values throughout your configuration using the `${VARIABLE_NAME}` syntax. The `env` section supports two forms: a map form for static key-value pairs and an extended list form for advanced use cases like file-backed secrets with automatic refresh.
4
4
5
-
Values set in the `env` section are case-sensitive. However, as a best practice, Fluent Bit recommends using uppercase names for environment variables. The following example defines two variables, `FLUSH_INTERVAL` and `STDOUT_FMT`, which can be accessed in the configuration using `${FLUSH_INTERVAL}` and `${STDOUT_FMT}`:
5
+
Values set in the `env` section are case-sensitive. However, as a best practice, Fluent Bit recommends using uppercase names for environment variables.
6
+
7
+
## Map form
8
+
9
+
The map form defines variables as key-value pairs. The following example defines two variables, `FLUSH_INTERVAL` and `STDOUT_FMT`, which can be accessed in the configuration using `${FLUSH_INTERVAL}` and `${STDOUT_FMT}`:
6
10
7
11
```yaml
8
12
env:
@@ -23,6 +27,44 @@ pipeline:
23
27
format: ${STDOUT_FMT}
24
28
```
25
29
30
+
## Extended list form
31
+
32
+
The `env` section also accepts a YAML list of entries. Each entry is a mapping with the following properties:
33
+
34
+
| Property | Required | Description |
35
+
| :------- | :------- | :---------- |
36
+
| `name` | Yes | The name of the environment variable. |
37
+
| `value` | No | An explicit value for the variable. Mutually exclusive with `uri`. |
38
+
| `uri` | No | A URI pointing to the variable's value source. Currently supports `file://` `URIs` (for example, `file:///run/secrets/my_secret`). The file contents are read and used as the variable's value. |
39
+
| `refresh_interval` | No | How often (in seconds) to re-read the value from the `uri` source. Only meaningful when `uri` is set. Default is `0` (read once at startup). |
40
+
41
+
Either `value` or `uri` must be provided for each entry.
42
+
43
+
When `uri` and `refresh_interval` are both set, Fluent Bit re-reads the file at the specified interval. This enables dynamic configuration values, such as rotating secrets, without restarting Fluent Bit. If `refresh_interval` is `0` or omitted, the file is read only once at startup.
44
+
45
+
```yaml
46
+
env:
47
+
- name: DB_PASSWORD
48
+
uri: file:///run/secrets/db_password
49
+
refresh_interval: 60
50
+
- name: REGION
51
+
value: us-east-1
52
+
53
+
service:
54
+
flush: 1
55
+
log_level: info
56
+
57
+
pipeline:
58
+
inputs:
59
+
- name: random
60
+
61
+
outputs:
62
+
- name: stdout
63
+
match: '*'
64
+
```
65
+
66
+
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`.
67
+
26
68
## Predefined variables
27
69
28
70
Fluent Bit supports the following predefined environment variables. You can reference these variables in configuration files without defining them in the `env` section.
0 commit comments