Splunk Search

フィールドの値を使用して判定を行いたい

blaku
Explorer

フィールドvalueに値が、affectedにその条件が入っています。

No  value   affected
1   10      =
2   5        =<
3   1        !=

イベント毎にaffectedでvalueの値を判定し、Trueのみ表示したいです。
(例だと6で検索するとNo2,3の両方が取れるようにしたいです。)
何か良い方法無いでしょうか。

0 Karma

tuemura_splunk
Splunk Employee
Splunk Employee

Splunkで使える比較演算子は6つなので、力技ですがcase文に全ていれてしまってはどうでしょうか。

YOUR_SEARCH OR INPUTLOOKUP
| eval i = 6
| eval flag=case(affected="=",if(value=i,"true","false"),affected="!=",if(value!=i,"true","false"),(affected="=<" OR affected="<="),if(value<=i,"true","false"),(affected="=>" OR affected=">="),if(value>=i,"true","false"),affected="<",if(value<i,"true","false"),affected=">",if(value>i,"true","false"))
| where flag="true"
0 Karma
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...