Splunk Search

Eval Case Statement Help

jhayIV
Engager

I would like to put a case statement under the values in the attached image.
I tried something along the lines of eval score=case(count* < 80 , 1)
but that did not work.
alt text

Tags (2)
0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Assuming you want to set score=1 if any field is below 80, try this:

... | eval score = 0 | foreach count* [eval score = max(if('<<FIELD>>' < 80, 1, 0), score)]

Assuming you want to set score=1 if all fields are below 80, try this:

... | eval score = 1 | foreach count* [eval score = min(if('<<FIELD>>' >= 80, 0, 1), score)]
0 Karma

somesoni2
Revered Legend

So you want a score of 1 if every count* field is less than 80?

0 Karma
Get Updates on the Splunk Community!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

(view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...