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!

Fall Into Learning with New Splunk Education Courses

Every month, Splunk Education releases new courses to help you branch out, strengthen your data science roots, ...

Super Optimize your Splunk Stats Searches: Unlocking the Power of tstats, TERM, and ...

By Martin Hettervik, Senior Consultant and Team Leader at Accelerate at Iver, Splunk MVPThe stats command is ...

How Splunk Observability Cloud Prevented a Major Payment Crisis in Minutes

Your bank's payment processing system is humming along during a busy afternoon, handling millions in hourly ...