# \[Solved\] Environment variable references doesn't seem to work in output

**URL:** <https://discuss.elastic.co/t/solved-environment-variable-references-doesnt-seem-to-work-in-output/63005>\
**Category:** Logstash\
**Created:** [October 13, 2016, 9:50pm UTC](https://discuss.elastic.co/t/solved-environment-variable-references-doesnt-seem-to-work-in-output/63005 "2016-10-13T21:50:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![stachdude](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stachdude/32/12491_2.png) [@stachdude](https://discuss.elastic.co/u/stachdude)\
**Post date:** [October 13, 2016, 9:50pm UTC](https://discuss.elastic.co/t/solved-environment-variable-references-doesnt-seem-to-work-in-output/63005/1 "2016-10-13T21:50:00Z")

</div>

Using 2.4.0 version of Logstash, I ve tried to use environment variable as index name setting of an elasticsearch output plugin as so:

I set env var :

`export ES_IDX="test"`

output part of config file

```
output {
  elasticsearch {
    hosts => ["127.0.0.1"]
    index => "${ES_IDX:test}-%{+YYYY.MM.dd}"
    manage_template => false
    workers => 4
  }
}

```

What I get is

> Failed action. {:status=\>400, :action=\>["index", {:\_id=\>nil, :\_index=\>"${ES\_IDX:test}-2016.10.03" .... Invalid index name [${ES\_IDX:test}-2016.10.03], must be lowercase]; "}}, :level=\>:warn}

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 15, 2016, 7:14am UTC](https://discuss.elastic.co/t/solved-environment-variable-references-doesnt-seem-to-work-in-output/63005/2 "2016-10-15T07:14:02Z")

</div>

Did you start LS with the right flag? [https://www.elastic.co/guide/en/logstash/current/environment-variables.html](https://www.elastic.co/guide/en/logstash/current/environment-variables.html)

---

<div class="post-metadata">

**Author:** ![stachdude](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stachdude/32/12491_2.png) [@stachdude](https://discuss.elastic.co/u/stachdude)\
**Post date:** [October 28, 2016, 6:30am UTC](https://discuss.elastic.co/t/solved-environment-variable-references-doesnt-seem-to-work-in-output/63005/3 "2016-10-28T06:30:45Z")

</div>

Thank you @warkolm, yo are right 🙂

---

<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:** [July 6, 2017, 4:32am UTC](https://discuss.elastic.co/t/solved-environment-variable-references-doesnt-seem-to-work-in-output/63005/4 "2017-07-06T04:32:13Z")

</div>


