Splunk Search

Limiting precision/decimal

pramodkumar
Path Finder

Hi,
Have scenario, when using avg() am getting values as 15.000000 but i want it as 15 without decimal, please help me.

Tags (3)
0 Karma
1 Solution

sdaniels
Splunk Employee
Splunk Employee

Use eval and the round() function.

<your search> |stats avg(whatever) as yourNumber | eval n=round(yourNumber)

http://docs.splunk.com/Documentation/Splunk/5.0.1/SearchReference/CommonEvalFunctions

View solution in original post

sdaniels
Splunk Employee
Splunk Employee

Use eval and the round() function.

<your search> |stats avg(whatever) as yourNumber | eval n=round(yourNumber)

http://docs.splunk.com/Documentation/Splunk/5.0.1/SearchReference/CommonEvalFunctions

sdaniels
Splunk Employee
Splunk Employee

This is probably better as a separate question with specific details. You can include this link to let people know you've already done some homework. Maybe you could create a macro where you pass in the values you want to round, in order to simplify the length of your search. Is the length and complexity of the search a concern?

0 Karma

sbsbb
Builder

yes but if you are making a "| chart avg(smthing) over somethingelse by something " then you have to eval each column explicitly, for me it is not possible, there must be a better way

0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...