Splunk Search

round funtion usage to round the decimal dgits after the precision

rakesh_498115
Motivator

Hi ,

I have been using the stats avg(duration) as Avg_Duration in my query.But while displayin the Avg_Duration i am getting the output value with 6 decimal digits after the precision.Something like 2.123456 i would like to round it off to four digits only.Tried using the round function along with the stats command..but it didnt worked.

Please help me on this .Thanx

Tags (2)
0 Karma
1 Solution

Ayn
Legend

Just add an eval after your stats command:

... | stats avg(duration) as Avg_Duration | eval Avg_Duration=round(Avg_Duration,4)

View solution in original post

Ayn
Legend

Just add an eval after your stats command:

... | stats avg(duration) as Avg_Duration | eval Avg_Duration=round(Avg_Duration,4)

Ayn
Legend

No problem. Could you please mark my answer as accepted? Thanks!

0 Karma

rakesh_498115
Motivator

Thank you so much !

0 Karma

Ayn
Legend

Upvote returned. 🙂

0 Karma

Drainy
Champion

Well this is awkward, we both appear to have answered the same question in different threads... suppose I should offer you an upvote as a highfive

0 Karma
Get Updates on the Splunk Community!

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...