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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...