Boolean Env vars

Dear Elastic Team,

Would like the know if it's possible to put a env variable as shown below:

- module: mysql
enabled: ${MYSQL_ENABLE}
  metricsets:

https://www.elastic.co/guide/en/beats/heartbeat/current/using-environ-vars.html

Hi @yasin :slight_smile:

We currently don't support anything like this. Environment variable expansion is used for dynamic values in already defined fields.

The only workaround I can think of now is to have a bash script that runs metricbeat and activates/deactivates a module before running with with metricbeat enable module [module]

1 Like

Dear Mario,

Thank you for your swift reply. I'm using the reference.yml file in my metricbeat.yml so how will this be reflected when enabling the module or disabling it?
When enabling, will my configuration in modules.d be enabled or my metricbeat.yml file will be used?

Dear Carlo,

Maybe a better solution is to leave the ENV variable empty.
Topic can be closed.

If you use the config file for the module defined in the modules.d folder, the config is stored in it with a .disabled extension (or not) but you don't loose it.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.