Dashboards & Visualizations

eval calculation

sahana
Engager

I have a JSON object value as timetaken= 63542 in milliseconds, I  need to convert the stats max(timetaken) value which is in ms to seconds tried as like below  but it is not working out. 

search envId = *  message=PostLogin* | stats min(timetaken),max(timetaken), Avg(timetaken) | eval max_time=round((max(timetaken)/1000),2) , min_time = round((min(timetaken)/1000),2) | table max_time,min_time,Avg(timetaken)

 

But the above is producing the values in same ms even we convert it to seconds

 

 

0 Karma

isoutamo
SplunkTrust
SplunkTrust

Hi

You should assign values in stats to the new name like this

search envId = * message=PostLogin* 
| stats min(timetaken) as minTimeTaken, max(timetaken) as maxTimeTaken,  Avg(timetaken) as avgTimeTaken
| eval max_time=round(maxTimeTaken/1000,2) , min_time = round(minTimeTaken/1000,2) 
| table max_time,min_time,avgTimeTaken

Otherwise there could be some confusion on eval.

r. Ismo 

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...

Keep the Learning Going with the New Best of .conf Hub

Hello Splunkers, With .conf26 getting closer, there’s already a lot of excitement building around this year’s ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...