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
Get Updates on the Splunk Community!

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...

September Community Champions: A Shoutout to Our Contributors!

As we close the books on another fantastic month, we want to take a moment to celebrate the people who are the ...

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...