Splunk Search

Need help on Splunk search for if else condition

sekhar463
Path Finder

hi All,

can someone help on the splunk search eval condition based on below scenario using fields 

Actualstarttime and job_start_by

 

if job_start_by<= Actualstarttime

return "GREEN / STARTED ON TIME"
else:
return "AMBER / STARTED LATE"

else:
if now <= Actualstarttime
return "EARLY / NO DATA"
else:
return "RED / START SLA BREACH"


if now > Actualstarttime
return "RED / END SLA BREACH"
else:
return "BLUE / RUNNING"

Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

All time fields are assumed to be in epoch time, i.e. number of seconds since the beginning of 1970.

| eval start_time = if (job_start_by<= Actualstarttime, "GREEN / STARTED ON TIME", "AMBER / STARTED LATE")
| eval early_red = if (now() <= Actualstarttime, "EARLY / NO DATA", "RED / START SLA BREACH")
| eval red_blue = if (now() > Actualstarttime, "RED / END SLA BREACH", "BLUE / RUNNING")
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...