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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...