WARNING: Version 5.0 of Beats has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Environment Variables
editEnvironment Variables
editBeats support use of environment variables in config files to set values that
need to be configurable during deployment. Environment variable expansion is
introduced using ${VAR}
, where VAR
is the name of the environment variable.
Note: Only values can be set using environment variables. Environment variables usage in namespace and setting names are not supported.
Variable references are replaced when settings are read by beats. The replacement is case-sensitive and occurs after the YAML file itself has been parsed. References to undefined variables will lead to errors when dereferenced and no default value is specified. To specify a default value, use:
${VAR:default_value}
Where default_value
is the value to use if the environment variable is
undefined.
If you need to use a literal ${
in your configuration file then you can write
$${
to escape the expansion. The $
symbol can be used to escape other
characters in the default_value like using $}
in order to generate a }
character without closing the variable expansion.
After changing the value of an environment variable, the beat needs to be restarted to pick up the new value.
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 |
|
|
|
|