Filebeat.yml not parsing the env variables

Hi,
I am using env variables in filebeat.yml, it is failing to parse the variables.

filebeat.yml

output.elasticsearch:
hosts: [$ELASTICSEARCH_HOST]
template:
  name: "filebeat"
  path: "fields.yml"
overwrite: false
protocol: "http"

docker-compose.yml

version: "3.5"

services:

 filebeat:
  build:
  context: ./filebeat
  args:
    ELK_VERSION: $ELK_VERSION
volumes:
 - "/var/lib/docker/containers:/usr/share/dockerlogs/data:ro"
 - "/var/run/docker.sock:/var/run/docker.sock"

networks:
 default:
 name: filebeat-nw
 external: true

I am running the container as a service with the command "docker-compose up --build"

Could you please help me to understand how to use env variables in filebeat.yml file.

Thank You.

You need to write ${ELASTICSEARCH_HOST} to get the value.
See more: https://www.elastic.co/guide/en/beats/filebeat/current/using-environ-vars.html

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