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!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...