# If Conditional around input filter doesn't appear to be working

**URL:** <https://discuss.elastic.co/t/if-conditional-around-input-filter-doesnt-appear-to-be-working/66166>\
**Category:** Logstash\
**Created:** [November 15, 2016, 8:29pm UTC](https://discuss.elastic.co/t/if-conditional-around-input-filter-doesnt-appear-to-be-working/66166 "2016-11-15T20:29:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sjivan](https://avatars.discourse-cdn.com/v4/letter/s/c57346/32.png) [@sjivan](https://discuss.elastic.co/u/sjivan)\
**Post date:** [November 15, 2016, 8:29pm UTC](https://discuss.elastic.co/t/if-conditional-around-input-filter-doesnt-appear-to-be-working/66166/1 "2016-11-15T20:29:21Z")

</div>

I'm trying to setup conditional file input sources based on an environment variable and it was reading the file even when the condition was false.

To simplify the test I setup

```
input {
     if 1 == 2 {
            file {
                  path => ...
            }
     }
}

```

Logstash picks up the file source despite the false condition. Any idea why?

Using LS 5.0

Thanks,  
Sanjiv

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [November 16, 2016, 4:47am UTC](https://discuss.elastic.co/t/if-conditional-around-input-filter-doesnt-appear-to-be-working/66166/2 "2016-11-16T04:47:33Z")

</div>

Having conditionals within input blocks probably doesn't work. Up until the rather recent addition of the environment variable feature it hasn't been meaningful to have conditionals. But if it's not supposed to work then Logstash should complain about the conditional rather than just ignore it. Could you file a GitHub issue?

---

<div class="post-metadata">

**Author:** ![sjivan](https://avatars.discourse-cdn.com/v4/letter/s/c57346/32.png) [@sjivan](https://discuss.elastic.co/u/sjivan)\
**Post date:** [November 16, 2016, 10:27am UTC](https://discuss.elastic.co/t/if-conditional-around-input-filter-doesnt-appear-to-be-working/66166/3 "2016-11-16T10:27:00Z")

</div>

Filed an issue : [https://github.com/elastic/logstash/issues/6263](https://github.com/elastic/logstash/issues/6263)

Thanks,  
Sanjiv

---

<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:** [December 14, 2016, 10:27am UTC](https://discuss.elastic.co/t/if-conditional-around-input-filter-doesnt-appear-to-be-working/66166/4 "2016-12-14T10:27:25Z")

</div>

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