Splunk Search

Using Eval function to calculate percentage

ldlopez38
Observer

I'm hoping someone can help me out here. I'm looking to create a simple table that displays a column for "count" and another for "Percentage of total". For some reason splunk is not recognizing the total field within the denominator of my eval command. Any suggestions on how to append this? 

 

index=ABC sourcetype="ABC" "EVNT=SWIendcall" |stats count by OUTCOME | addtotals row=f col=t labelfield=OUTCOME |eval Percentage=ROUND((count/Total)*100,1)

ldlopez38_0-1656022941493.png

 

Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Splunk generally works on a pipeline of events so the total has to be a field in each event. Try something like this.

index=ABC sourcetype="ABC" "EVNT=SWIendcall" |stats count by OUTCOME 
| eventstats sum(count) as Total
| eval Percentage=ROUND((count/Total)*100,1)
| addtotals row=f col=t labelfield=OUTCOME 
Get Updates on the Splunk Community!

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

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