Hi there!
How can I use keystore variables in autodiscover.providers.templates.config
section of metricbeat.yml? It looks like broken. Version 7.1.0.
How to reproduce:
- Setup Docker for running next services
- Setup Elasticsearch and configure Metricbeat to connect to it
- Run a RabbitMQ service with an username and a password for authorization
- Add QUEUE_USERNAME and QUEUE_PASSWORD to Metricbeat keystore via
metricbeat keystore add
with appropriate values - Add a block like this to metricbeat.yml:
autodiscover:
providers:
- type: docker
templates:
- condition:
equals:
docker.container.labels.com.docker.swarm.service.name: depth-history_queue
config:
- module: rabbitmq
period: 10s
hosts: ['${data.host}:${data.port}']
username: ${QUEUE_USERNAME}
password: ${QUEUE_PASSWORD}
- Start the beat
Expected:
Metricbeat successfully connected to RabbitMQ service.
But it doesn't.
Interesting additional info:
-
For debugging purposes, you can use "
${QUEUE_PASSWORD}
" as a value for fieldoutput.elasticsearch.hosts
of metricbeat.yml and you will see the finish value ofQUEUE_PASSWORD
variable from the keystore in logs of the beat (in error messages about the connection to Elasticsearch). Therefore the keystore really store the correct value. -
If you replace
${QUEUE_USERNAME}
and${QUEUE_PASSWORD}
by hard-coded values in metricbeat.yml and restart the beat it will work. Therefore Metricbeat can connect to RabbitMQ with auth. -
Even if you return the vars back to metricbeat.yml and add 2 Linux env vars
QUEUE_USERNAME
andQUEUE_PASSWORD
and restart the beat it will work too. Therefore some variables substitution works in theautodiscover.providers.templates.config
section.