# Environment variables in if..then logic

**URL:** https://discuss.elastic.co/t/environment-variables-in-if-then-logic/197099
**Category:** Logstash
**Created:** [August 28, 2019, 11:34am UTC](https://discuss.elastic.co/t/environment-variables-in-if-then-logic/197099 "2019-08-28T11:34:20Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [August 28, 2019, 12:13pm UTC](https://discuss.elastic.co/t/environment-variables-in-if-then-logic/197099/2 "2019-08-28T12:13:37Z")

</div>

> [@pgf](#):
>
> What am I doing wrong?

This is not [supported](https://github.com/elastic/logstash/issues/5115). The workaround is to use mutate+add\_field to add a field to [@metadata] then test that.

---

_[View the full topic](https://discuss.elastic.co/t/environment-variables-in-if-then-logic/197099)._
