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!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...