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!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...