WARNING: Version 5.0 of Filebeat 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.
Using Environment Variables in the Configurationedit
This functionality is experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features.
You can use environment variable references in the filebeat.yml
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. 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.
After changing the value of an environment variable, you need to restart Filebeat to pick up the new value.
Examplesedit
Here 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 |
|
|
|
|