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

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...

Introduction to Splunk AI

How are you using AI in Splunk? Whether you see AI as a threat or opportunity, AI is here to stay. Lucky for ...