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


(Sanjiv Jivan) #1

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


(Magnus B├Ąck) #2

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?


(Sanjiv Jivan) #3

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

Thanks,
Sanjiv


(system) #4

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