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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Thanks for the Memories! Splunk University, .conf25, and our Community

Thank you to everyone in the Splunk Community who joined us for .conf25, which kicked off with our iconic ...

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...

Introducing Splunk 10.0: Smarter, Faster, and More Powerful Than Ever

Now On Demand Whether you're managing complex deployments or looking to future-proof your data ...