Boolean Env vars

(yasin) #1

Dear Elastic Team,

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

- module: mysql
enabled: ${MYSQL_ENABLE}

(Mario Castro) #2

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
(yasin) #3

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?

(yasin) #4

Dear Carlo,

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

(Mario Castro) #5

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.