# Environment variable in filebeat

**URL:** https://discuss.elastic.co/t/environment-variable-in-filebeat/97579
**Category:** Beats
**Tags:** filebeat
**Created:** [August 18, 2017, 12:38pm UTC](https://discuss.elastic.co/t/environment-variable-in-filebeat/97579 "2017-08-18T12:38:44Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![sockaddr\_in](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sockaddr_in/32/20854_2.png) [@sockaddr\_in](https://discuss.elastic.co/u/sockaddr_in)
#### Post date: [August 18, 2017, 12:38pm UTC](https://discuss.elastic.co/t/environment-variable-in-filebeat/97579/1 "2017-08-18T12:38:44Z")

</div>

Hello everyone,  
Filebeat version: 5.5  
I used environment variable in filebeat config, but it report the error as following:

> filebeat2017/08/18 12:34:40.994010 beat.go:339: CRIT Exiting: error loading config file: yaml: line 21: did not find expected '-' indicator  
> Exiting: error loading config file: yaml: line 21: did not find expected '-' indicator

My filebeat config as following, the LOG\_PATH is environment variable i used:

> - input\_type: log  
> # Paths that should be crawled and fetched. Glob based paths.  
> paths:  
> - '${LOG\_PATH}'/access.log  
> fields:  
> type: access  
> business: nginx  
> fields\_under\_root: true

So what's the reason? That dose not support this syntax?

---

<div class="post-metadata">

### Author: ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)
#### Post date: [August 18, 2017, 1:15pm UTC](https://discuss.elastic.co/t/environment-variable-in-filebeat/97579/2 "2017-08-18T13:15:13Z")

</div>

The error message is not about the environment variable. The configuration file must be valid yaml.

When starting filebeat via systemd or init script, your environment variable is normally not forwarded to filebeat.

---

<div class="post-metadata">

### Author: ![sockaddr\_in](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sockaddr_in/32/20854_2.png) [@sockaddr\_in](https://discuss.elastic.co/u/sockaddr_in)
#### Post date: [August 20, 2017, 1:09am UTC](https://discuss.elastic.co/t/environment-variable-in-filebeat/97579/3 "2017-08-20T01:09:54Z")

</div>

Right, thank you,  
I solved this problem by modify - ‘${LOG\_PATH}’/access.log to - ‘${LOG\_PATH}/access.log'.

---

<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: [September 17, 2017, 1:09am UTC](https://discuss.elastic.co/t/environment-variable-in-filebeat/97579/4 "2017-09-17T01:09:58Z")

</div>

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