Or check in filter plugin


(Fredrick Yessaian) #1

Hello,

I have logstash configuration to get two types of inputs, one from File another from Beats.
So I'm setting type variable as "file_input" and "beats_input" respectively.

Next In the filter plugin, I have to have a if condition like below

if "file_input" in [type]{
  .....
} 

which is working fine.

But in one place have to have a check both the input types..
So want to know how to have OR check in the if condition?

if ["file_input" || "beats_input"] in [type]{
     .......
}

Please advise .. Thanks in advance


#2

You could do it using in as a test for array membership

if [type] in [ "file_input", "beat_input" ] 

Or you could do it like this

if [type] == "file_input" or [type] == "beat_input"

(Fredrick Yessaian) #3

Thank you so much Badger..


(system) #4

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