# Filebeat.yml not parsing the env variables

**URL:** <https://discuss.elastic.co/t/filebeat-yml-not-parsing-the-env-variables/173324>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [March 21, 2019, 2:01pm UTC](https://discuss.elastic.co/t/filebeat-yml-not-parsing-the-env-variables/173324 "2019-03-21T14:01:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![elkuserbsm](https://avatars.discourse-cdn.com/v4/letter/e/71c47a/32.png) [@elkuserbsm](https://discuss.elastic.co/u/elkuserbsm)\
**Post date:** [March 21, 2019, 2:01pm UTC](https://discuss.elastic.co/t/filebeat-yml-not-parsing-the-env-variables/173324/1 "2019-03-21T14:01:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kvch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kvch/32/72058_2.png) [@kvch](https://discuss.elastic.co/u/kvch)\
**Post date:** [March 29, 2019, 11:39am UTC](https://discuss.elastic.co/t/filebeat-yml-not-parsing-the-env-variables/173324/2 "2019-03-29T11:39:05Z")

</div>

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](https://www.elastic.co/guide/en/beats/filebeat/current/using-environ-vars.html)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 26, 2019, 11:39am UTC](https://discuss.elastic.co/t/filebeat-yml-not-parsing-the-env-variables/173324/3 "2019-04-26T11:39:08Z")

</div>

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