Sergey Potekhin
Sergey Potekhin

Reputation: 701

Can't make Metricbeat use passed env variable

I'm trying to run metricbeat service in docker, according to the official documentation (version 7.2.0). Here's my bash command for setup:

docker run -d --name=metricbeat docker.elastic.co/beats/metricbeat:7.2.0 setup\
 -e setup.kibana.host=http://XXX.XXX.XXX.XXX:5601\
 -e output.elasticsearch.host=["XXX.XXX.XXX.XXX:9200"]\
 -e output.elasticsearch.password=XXXXXXXX

As you see I'm passing the output.elasticsearch.host variable and it's definitely not equal to the default value. But here's the part of the metricbeat container logs:

2019-07-31T14:32:40.335Z        INFO    elasticsearch/client.go:166     Elasticsearch url: http://elasticsearch:9200

This means that metricbeat used the default Elastic host instead of the environment variable value. How can I fix it?

Upvotes: 2

Views: 1020

Answers (1)

Ortomala Lokni
Ortomala Lokni

Reputation: 62466

You have made a typo, there is a s missing in output.elasticsearch.hosts.

Use also double quotes around the whole environment variable definition and single quotes around the host value, such as:

-E "output.elasticsearch.hosts=['http://myhost:9200']"

The above example is directly taken from the official documentation about global flags.

Upvotes: 1

Related Questions