Splunk Enterprise

Unable to plot the duration by jobname!!

chinmay25
Path Finder

I am using the following query to get the average duration for certain Jobs. I want to have a visualization on a daily basis. However, for some reason I am unable to get a visualization. Below is the part of the query.

| eval AVGDURATION = (CALCEND - START)
| stats avg(AVGDURATION) as AVGDURATION by JOBNAME
| eval AVGDURATION = round(AVGDURATION, 2)
| eval HHMMSS=tostring(AVGDURATION, "duration")
| stats values(HHMMSS) as DURATION by JOBNAME

Labels (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

The problem is you're asking Splunk to plot strings rather than numbers.  You should get a visualization by removing the call to tostring().  The second stats command is not needed, either.

| eval AVGDURATION = (CALCEND - START)
| stats avg(AVGDURATION) as AVGDURATION by JOBNAME
| eval AVGDURATION = round(AVGDURATION, 2)

 

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

The problem is you're asking Splunk to plot strings rather than numbers.  You should get a visualization by removing the call to tostring().  The second stats command is not needed, either.

| eval AVGDURATION = (CALCEND - START)
| stats avg(AVGDURATION) as AVGDURATION by JOBNAME
| eval AVGDURATION = round(AVGDURATION, 2)

 

---
If this reply helps you, Karma would be appreciated.

chinmay25
Path Finder

Hi Rich,

Thanks for the reply. I was able to get it. Was just having a brain freeze earlier.

Thanks for the help.

0 Karma
Get Updates on the Splunk Community!

Celebrating Fast Lane: 2025 Authorized Learning Partner of the Year

At .conf25, Splunk proudly recognized Fast Lane as the 2025 Authorized Learning Partner of the Year. This ...

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...