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!

New in Observability - Improvements to Custom Metrics SLOs, Log Observer Connect & ...

The latest enhancements to the Splunk observability portfolio deliver improved SLO management accuracy, better ...

Improve Data Pipelines Using Splunk Data Management

  Register Now   This Tech Talk will explore the pipeline management offerings Edge Processor and Ingest ...

3-2-1 Go! How Fast Can You Debug Microservices with Observability Cloud?

Register Join this Tech Talk to learn how unique features like Service Centric Views, Tag Spotlight, and ...