Splunk Search

Converting Percentages to Decimal based Percentages

Dark_Ichigo
Builder

I want to change the percentage results of the follwoing search into decimal based Percentages, as I want the 0.5% for example to show instead of just a 0%

The following search:

index="<index>"   | eventstats sum(S1) as S1 | eventstats sum(S1) as S2 by seconds | eval S_final = S2*100/S1 | chart first(S_final) as S_Solution by seconds 

I also would like to know how to add the percentile Unit to the values, is that possible?

0 Karma
1 Solution

yannK
Splunk Employee
Splunk Employee

For results in table you can concatenate the field with a string.


eval S_final=(S2*100/S1)."%"

but for a graph, it's more on the options of the dashboard.

View solution in original post

yannK
Splunk Employee
Splunk Employee

For results in table you can concatenate the field with a string.


eval S_final=(S2*100/S1)."%"

but for a graph, it's more on the options of the dashboard.

Dark_Ichigo
Builder

Thanks for that, I wanted to add percentage units to the table view and it worked fine.

I also managed to solve the issue with the search results to be floating point based numbers instead of whole numbers and it was the summary indexed data that was playing up so I just ran another backfill script 🙂

0 Karma
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 ...