Splunk Search

Making a where statement that checks run time?

JoshuaJohn
Contributor

I have this query

index=nitro_prod  earliest=-30d ESK** (job_class=* OR NOT job_class=*) compl_code=*  | fields app_id job_name job_no appl_gen appl_sys job_qual job_start_datetime job_end_datetime run_time_in_minutes cpu_min cpu_sec actual_s_units job_class compl_code run_time_in_minutes total_cpu_time_in_minutes input_qt_min | eval age_hr=(now()-_time)/60/60 | eval Last24=if(age_hr<=24,"Yes","No") |eval Last48=if(age_hr<=48,"Yes","No") | eval LastWeek=if(age_hr<=168,"Yes","No") |  eval LastMonth=if(age_hr<=720,"Yes","No")|eval 24hr=if(Last24="Yes",run_time_in_minutes,NULL) | eval 48hr=if(Last48="Yes",run_time_in_minutes,NULL) | eval week=if(LastWeek="Yes",run_time_in_minutes,NULL) | eval month=if(LastMonth="Yes",run_time_in_minutes,NULL)| stats sparkline(avg(run_time_in_minutes),24h) as "Trending Daily Average" avg(24hr) as "Day" avg(48hr) as "TwoDay" avg(week) as "Week" avg(month) as "Month" by job_name | eval ratio = Day/Month | where ratio > 3 | stats count

I want to limit this to only look at run times over 1 minute
Any ideas?

0 Karma

sundareshr
Legend

You should be able to filter it in the base search. Try this

index=nitro_prod  earliest=-30d ESK** (job_class=* OR NOT job_class=*) compl_code=*  run_time_in_minutes>1 | fields app_id job_name job_no appl_gen appl_sys job_qual job_start_datetime job_end_datetime cpu_min cpu_sec actual_s_units job_class compl_code run_time_in_minutes total_cpu_time_in_minutes input_qt_min | eval age_hr=(now()-_time)/60/60 | eval Last24=if(age_hr<=24,"Yes","No") |eval Last48=if(age_hr<=48,"Yes","No") | eval LastWeek=if(age_hr<=168,"Yes","No") |  eval LastMonth=if(age_hr<=720,"Yes","No")|eval 24hr=if(Last24="Yes",run_time_in_minutes,NULL) | eval 48hr=if(Last48="Yes",run_time_in_minutes,NULL) | eval week=if(LastWeek="Yes",run_time_in_minutes,NULL) | eval month=if(LastMonth="Yes",run_time_in_minutes,NULL)| stats sparkline(avg(run_time_in_minutes),24h) as "Trending Daily Average" avg(24hr) as "Day" avg(48hr) as "TwoDay" avg(week) as "Week" avg(month) as "Month" by job_name | eval ratio = Day/Month | where ratio > 3 | stats count
0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...