Splunk Search

how to limit percent results to 2 decimal places

edookati
Path Finder

I am using the below query to form a table, but the percent values have up to 6 decimal places.
Can you please let me know how to limit them to 2 decimal places?

Query:
index=jms_logs osb_Service="CRMCaseService.Services.CRMCaseService" | eventstats count by Reason | top Reason

Results:
Reason count percent
Case(s) updated successfully 144 96.000000
Could not update case since Case not found in salesforce 5 3.333333
Case Found but the contact information does not match 1 0.666667

Thanks.

Tags (1)
1 Solution

strive
Influencer

Try this

index=jms_logs osb_Service="CRMCaseService.Services.CRMCaseService" | eventstats count by Reason | top Reason | eval percent=round(percent,2)

View solution in original post

martin_mueller
SplunkTrust
SplunkTrust

Isn't the eventstats obsolete in that search?

strive
Influencer

Try this

index=jms_logs osb_Service="CRMCaseService.Services.CRMCaseService" | eventstats count by Reason | top Reason | eval percent=round(percent,2)

edookati
Path Finder

perfect. It worked.

Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...