- Beats Platform Reference: other versions:
- What are Beats?
- Community Beats
- Get started with Beats
- Config file format
- Upgrade
- Release notes
- Beats version 8.17.0
- Beats version 8.16.1
- Beats version 8.16.0
- Beats version 8.15.5
- Beats version 8.15.4
- Beats version 8.15.3
- Beats version 8.15.2
- Beats version 8.15.1
- Beats version 8.15.0
- Beats version 8.14.3
- Beats version 8.14.2
- Beats version 8.14.1
- Beats version 8.14.0
- Beats version 8.13.4
- Beats version 8.13.3
- Beats version 8.13.2
- Beats version 8.13.1
- Beats version 8.13.0
- Beats version 8.12.2
- Beats version 8.12.1
- Beats version 8.12.0
- Beats version 8.11.4
- Beats version 8.11.3
- Beats version 8.11.2
- Beats version 8.11.1
- Beats version 8.11.0
- Beats version 8.10.4
- Beats version 8.10.3
- Beats version 8.10.2
- Beats version 8.10.1
- Beats version 8.10.0
- Beats version 8.9.2
- Beats version 8.9.1
- Beats version 8.9.0
- Beats version 8.8.2
- Beats version 8.8.1
- Beats version 8.8.0
- Beats version 8.7.1
- Beats version 8.7.0
- Beats version 8.6.2
- Beats version 8.6.1
- Beats version 8.6.0
- Beats version 8.5.3
- Beats version 8.5.2
- Beats version 8.5.1
- Beats version 8.5.0
- Beats version 8.4.3
- Beats version 8.4.2
- Beats version 8.4.1
- Beats version 8.4.0
- Beats version 8.3.3
- Beats version 8.3.2
- Beats version 8.3.1
- Beats version 8.3.0
- Beats version 8.2.3
- Beats version 8.2.2
- Beats version 8.2.1
- Beats version 8.2.0
- Beats version 8.1.3
- Beats version 8.1.2
- Beats version 8.1.1
- Beats version 8.1.0
- Beats version 8.0.1
- Beats version 8.0.0
- Beats version 7.17.0
- Beats version 7.16.3
- Beats version 7.16.2
- Beats version 7.16.1
- Beats version 7.16.0
- Beats version 7.15.2
- Beats version 7.15.1
- Beats version 7.15.0
- Beats version 7.14.2
- Beats version 7.14.1
- Beats version 7.14.0
- Beats version 7.13.4
- Beats version 7.13.3
- Beats version 7.13.2
- Beats version 7.13.1
- Beats version 7.13.0
- Beats version 7.12.1
- Beats version 7.12.0
- Beats version 7.11.2
- Beats version 7.11.1
- Beats version 7.11.0
- Beats version 7.10.2
- Beats version 7.10.1
- Beats version 7.10.0
- Beats version 7.9.3
- Beats version 7.9.2
- Beats version 7.9.1
- Beats version 7.9.0
- Beats version 7.8.1
- Beats version 7.8.0
- Beats version 7.7.1
- Beats version 7.7.0
- Beats version 7.6.2
- Beats version 7.6.1
- Beats version 7.6.0
- Beats version 7.5.2
- Beats version 7.5.1
- Beats version 7.5.0
- Beats version 7.4.2
- Beats version 7.4.1
- Beats version 7.4.0
- Beats version 7.3.2
- Beats version 7.3.1
- Beats version 7.3.0
- Beats version 7.2.1
- Beats version 7.2.0
- Beats version 7.1.1
- Beats version 7.1.0
- Beats version 7.0.1
- Beats version 7.0.0
- Beats version 7.0.0-GA
- Beats version 7.0.0-rc2
- Beats version 7.0.0-rc1
- Beats version 7.0.0-beta1
- Beats version 7.0.0-alpha2
- Beats version 7.0.0-alpha1
- Beats version 6.8.13
- Beats version 6.8.12
- Beats version 6.8.11
- Beats version 6.8.10
- Beats version 6.8.9
- Beats version 6.8.8
- Beats version 6.8.7
- Beats version 6.8.6
- Beats version 6.8.5
- Beats version 6.8.4
- Beats version 6.8.3
- Beats version 6.8.2
- Beats version 6.8.1
- Beats version 6.8.0
- Beats version 6.7.2
- Beats version 6.7.1
- Beats version 6.7.0
- Beats version 6.6.2
- Beats version 6.6.1
- Beats version 6.6.0
- Beats version 6.5.4
- Beats version 6.5.3
- Beats version 6.5.2
- Beats version 6.5.1
- Beats version 6.5.0
- Beats version 6.4.3
- Beats version 6.4.2
- Beats version 6.4.1
- Beats version 6.4.0
- Beats version 6.3.1
- Beats version 6.3.0
- Beats version 6.2.3
- Beats version 6.2.2
- Beats version 6.2.1
- Beats version 6.2.0
- Beats version 6.1.3
- Beats version 6.1.2
- Beats version 6.1.1
- Beats version 6.1.0
- Beats version 6.0.1
- Beats version 6.0.0
- Beats version 6.0.0-GA
- Beats version 6.0.0-rc2
- Beats version 6.0.0-rc1
- Beats version 6.0.0-beta2
- Beats version 6.0.0-beta1
- Beats version 6.0.0-alpha2
- Beats version 6.0.0-alpha1
- Beats version 5.6.14
- Beats version 5.6.13
- Beats version 5.6.12
- Beats version 5.6.11
- Beats version 5.6.10
- Beats version 5.6.9
- Beats version 5.6.8
- Beats version 5.6.7
- Beats version 5.6.6
- Beats version 5.6.5
- Beats version 5.6.4
- Beats version 5.6.3
- Beats version 5.6.2
- Beats version 5.6.1
- Beats version 5.6.0
- Beats version 5.5.3
- Beats version 5.5.2
- Beats version 5.5.1
- Beats version 5.5.0
- Beats version 5.4.2
- Beats version 5.4.1
- Beats version 5.4.0
- Beats version 5.3.2
- Beats version 5.3.1
- Beats version 5.3.0
- Beats version 5.2.2
- Beats version 5.2.1
- Beats version 5.2.0
- Beats version 5.1.2
- Beats version 5.1.1
- Beats version 5.1.0 (skipped)
- Beats version 5.0.2
- Beats version 5.0.1
- Beats version 5.0.0
- Beats version 5.0.0-GA
- Beats version 5.0.0-rc1
- Beats version 5.0.0-beta1
- Beats version 5.0.0-alpha5
- Beats version 5.0.0-alpha4
- Beats version 5.0.0-alpha3
- Beats version 5.0.0-alpha2
- Beats version 5.0.0-alpha1
- Beats version 1.3.1
- Beats version 1.3.0
- Beats version 1.2.3
- Beats version 1.2.2
- Beats version 1.2.1
- Beats version 1.2.0
- Beats version 1.1.2
- Beats version 1.1.1
- Beats version 1.1.0
- Beats version 1.0.1
- Beats version 1.0.0
- Beats version 1.0.0-rc2
- Beats version 1.0.0-rc1
- Beats version 1.0.0-beta4
- Breaking changes
- Contribute to Beats
Environment variables
editEnvironment variables
editYou can use environment variable references in the config file to set values that need to be configurable during deployment. To do this, use:
${VAR}
Where VAR
is the name of the environment variable.
Each variable reference is replaced at startup by the value of the environment variable. The replacement is case-sensitive and occurs before the YAML file is parsed. References to undefined variables are replaced by empty strings unless you specify a default value or custom error text.
To specify a default value, use:
${VAR:default_value}
Where default_value
is the value to use if the environment variable is
undefined.
To specify custom error text, use:
${VAR:?error_text}
Where error_text
is custom text that will be prepended to the error
message if the environment variable cannot be expanded.
If you need to use a special character in your configuration file, use $
to escape the expansion. For example, you can escape ${
or }
with $${
or $}
.
After changing the value of an environment variable, you need to restart a Beat to pick up the new value.
You can also specify environment variables when you override a config
setting from the command line by using the -E
option. For example:
-E name=${NAME}
Examples
editHere are some examples of configurations that use environment variables and what each configuration looks like after replacement:
Config source | Environment setting | Config after replacement |
---|---|---|
|
|
|
|
no setting |
|
|
no setting |
|
|
|
|
|
no setting |
None. Returns an error message that’s prepended with the custom text. |
|
|
|
Specify complex objects in environment variables
editYou can specify complex objects, such as lists or dictionaries, in environment variables by using a JSON-like syntax.
As with JSON, dictionaries and lists are constructed using {}
and []
. But
unlike JSON, the syntax allows for trailing commas and slightly different string
quotation rules. Strings can be unquoted, single-quoted, or double-quoted, as a
convenience for simple settings and to make it easier for you to mix quotation
usage in the shell. Arrays at the top-level do not require brackets ([]
).
For example, the following environment variable is set to a list:
ES_HOSTS="10.45.3.2:9220,10.45.3.1:9230"
You can reference this variable in the config file:
output.elasticsearch: hosts: '${ES_HOSTS}'
When a Beat loads the config file, it resolves the environment variable and
replaces it with the specified list before reading the hosts
setting.
Do not use double-quotes ("
) to wrap regular expressions, or the backslash (\
) will be interpreted as an escape character.