IS it possible to use "nested else if" in logstash.conf

hello~

Is it possible to use "nested else if" in filter section inside logstash.conf
logstash 7.10.2

example
else if ... {
if ...{
else if .... {
....
}
}
}

Yes, it's possible in 7.x, check documentation. Pay attention on curly brackets, with too many IFs, things can be messy.

if [field1]=="something"{
   if ( [field2]=="value1" or [field2]=="valu2" ){
   ...
   }
}
else if "value" in [tags]{
 ...}
else {
...
}

Also you can use IFs in the output section.

oh thanks but that means,
** else if inside if * becuase it's not working

if [field1] == "somthing"{
    ...
}
else if [field1]=="something"{
   if ( [field2]=="value1" or [field2]=="valu2" ){
   ...
    }
  }

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