Splunk Search

How to get percentage in stats instead of count?

zacksoft
Contributor

I am calculating number of web-calls that were served in certain seconds.
| stats count(web-calls) as web-call-count by server_response.

So, in x axis I see the seconds, and Y axis i see the number of web-calls ..in a column chart.
What we are looking for is, "Can we get the percentage of web-calls instead of count in Y-axis" ?

Tags (2)
0 Karma
1 Solution

kamlesh_vaghela
SplunkTrust
SplunkTrust

@zacksoft

Can you please try this?

YOUR_SEARCH | stats count(web-calls) as web-call-count by server_response | eventstats sum(web-call-count) as total | eval percentage=round((web-call-count*100/total),2) | table server_response percentage

View solution in original post

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@zacksoft

Can you please try this?

YOUR_SEARCH | stats count(web-calls) as web-call-count by server_response | eventstats sum(web-call-count) as total | eval percentage=round((web-call-count*100/total),2) | table server_response percentage
0 Karma

zacksoft
Contributor

The command works perfectly. Thank you...
If I may add one more thing, Is it possible to create buckets ..say something like 3 buckets.
Bucket 1 showing the percentage of web-calls whose response were less than a second.
Bucket 2 showing percentage of web-calls ...between 1 to 10 sec.
Bucket 3 showing ..more tan 10 sec..

May be in a column chart showing three columns as three buckets or any other way..we can visualize ???

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@zacksoft
Yes, we can eval one more filed Bucket. For this sample data and expected output will be appreciated. 🙂

0 Karma

zacksoft
Contributor
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...