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!

Build the Future of Agentic AI: Join the Splunk Agentic Ops Hackathon

AI is changing how teams investigate incidents, detect threats, automate workflows, and build intelligent ...

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

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