Metricbeat docker compose environment variables

Hi all,

I am trying to set up stack monitoring using docker via docker compose.
Here is a sample I found on the Internet that uses the ELASTICSEARCH_HOSTS variable. I'd like to define more in this section like the module to be used etc.


  metricbeat:
    image: docker.elastic.co/beats/metricbeat:7.11.1
    environment:
      ELASTICSEARCH_HOSTS: http://node01:9200
    volumes:
      - metricbeat-data01:/usr/share/metricbeat/data
    networks:
      - es-network
    depends_on:
      - node01

I'd like to configure as much as possible directly via docker compose, but I cannot find a detailed list of available environment variables. Could you please share the list or even better provide a link to the correct documentation side?

Hi @TobiasSackmann

There are some ways you can configure metricbeat without having to edit the file:

  • You can create a configuration file that uses some environment variables as explained in our docs
  • Use CLI arguments to override some elements from the configuration file

The docker image you're using uses a configuration file that reads from environment variables, it has got something like that:

output.elasticsearch:
  hosts: '${ELASTICSEARCH_HOSTS:elasticsearch:9200}'
  username: '${ELASTICSEARCH_USERNAME:}'
  password: '${ELASTICSEARCH_PASSWORD:}'

Hence the values you can configure using environment variables.

The problem is not the output.Elasticsearch section which is filled by the
ELASTICSEARCH_HOSTS variable. I would rather need the kibana equivalent to fill this section.

setup.kibana:
  host: 'kibana:5601'

Currently the setup.kibana part is completely missing when I have a look at the metricbeat.yml within the docker container.

Unfortunately, none of your links provides a full list of variables nor does the metricbeat.reference.yml within the docker container.

A full list of environment variables that are processed would be appreciated(or at least the one for the kibana hosts).

Kind regards
Tobias

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