How can I match a numeric field against a long list of numbers?
Would it be best to use grok or ruby?
I can do it for one but there must be a more elegant way than this.
My match list is non linear so I cannot use greater than or any of the other operators.
if [filed] == 9991 {
...
} else if [field] == 5678 {
...
}
} else if [field] == 91011 {
...
}
} else if [field] == 121314 {
...
} else {
...
}
if [field] in [9991, 5678, 91011, 121314] {
...
}
else {
...
}
Custom Ruby code is also an option, and could be a better alternative depending on what you want to do when the value matches. If you are going to use Ruby inside the if branch to manipulate numbers, it may make sense to also have the actual check inside the Ruby block.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.