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

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

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?

Filed an issue : https://github.com/elastic/logstash/issues/6263

Thanks,
Sanjiv

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