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!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...