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
SplunkTrust
SplunkTrust

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

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...