How to Round Off Decimal Values with TIMECHART command in Splunk

How to Round Off Decimal Values with TIMECHART command in Splunk

Hello everyone !! We usually use the timechart command to show the data on time basis. But when we go for taking the average values of  any numerical field then sometimes it comes with decimal values. Now we will show you how to round off decimal values with timechart command. Below we have given an image of  sample data.

timechart1

You can round off all the values in the result set very easily. Below we have given the query :

index=_internal sourcetype=splunkd_ui_access NOT method=”HEAD” 
| timechart span=1d eval(round(avg(bytes),3)) by method

Result :

timechart2

Explanation:

In the above query method and bytes are existing field names in _internal index and sourcetype name is splunkd_ui_access . We have taken the average value of bytes field by method field. With the timechart command  we have used eval and round function together with avg function to get round off value upto 3 decimal points.

Hope this has helped you in achieving the below requirement without fail :

How to Round Off Decimal Values with TIMECHART command in Splunk

 

Happy Splunking !!

Advertisements

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.