Splunk Search

Why does Alerting when timetaken for job completion exceeds averagetime?

jrb65
Engager

Trying to find Time Taken for last 7 days for a batch job using splunk search, trying to find the average of the time taken and then finding the jobs that have time taken greater than average time.

splunk search | eval sTime=strptime(StartTime, "%B %d, %Y %I:%M:%S %p") | eval eTime=strptime(EndTime, "%B %d, %Y %I:%M:%S %p") | eval TimeTaken = ceil((eTime-sTime)/60) | stats avg(TimeTaken) as avgtime by JobbName | where TimeTaken > avgtime

Once I use the stats average command, the TimeTaken values are not coming up . Tried using streamstats but averagetime calculation is not right

 

 

 

 

Labels (2)
Tags (1)
0 Karma
1 Solution

yuanliu
SplunkTrust
SplunkTrust

The command you are looking for is eventstats.

splunk search
| eval sTime=strptime(StartTime, "%B %d, %Y %I:%M:%S %p")
| eval eTime=strptime(EndTime, "%B %d, %Y %I:%M:%S %p")
| eval TimeTaken = ceil((eTime-sTime)/60)
| eventstats avg(TimeTaken) as avgtime by JobbName
| where TimeTaken > avgtime

View solution in original post

Tags (1)
0 Karma

yuanliu
SplunkTrust
SplunkTrust

The command you are looking for is eventstats.

splunk search
| eval sTime=strptime(StartTime, "%B %d, %Y %I:%M:%S %p")
| eval eTime=strptime(EndTime, "%B %d, %Y %I:%M:%S %p")
| eval TimeTaken = ceil((eTime-sTime)/60)
| eventstats avg(TimeTaken) as avgtime by JobbName
| where TimeTaken > avgtime
Tags (1)
0 Karma

jrb65
Engager

Thanks yuanliu for the help.

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 ...