Splunk Search

Creating buckets based a percentage of occurrence.

zacksoft
Contributor

BASE_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

As a result of the above query following is the output I get in the statistics tab and a column chart in visualization tab.

server_respond percentage_of_web-calls
0.001 7.77
0.002 17.95
0.003 13.90
0.004 7.16
0.005 3.30
0.006 2.53
0.007 2.11
0.008

Can we create three columns in the visualization tab where
column 1 showing the percentage of web-calls whose response were less than a second.
column 2 showing percentage of web-calls ...whose response time between 1 to 10 sec.
column 3 showing ..more than 10 sec..

Tags (1)
0 Karma
1 Solution

kamlesh_vaghela
SplunkTrust
SplunkTrust

@zacksoft

Can you please try this?

BASE_SEARCH 
| eval bucket = case(server_respond<1,"Bucket 1", (server_respond > 1 AND server_respond < 10),"Bucket 2", 1=1,"Bucket 3")
| stats count(web-calls) as web-call-count by bucket 
| eventstats sum(web-call-count) as total 
| eval percentage=round((web-call-count*100/total),2) 
| table bucket percentage

View solution in original post

kamlesh_vaghela
SplunkTrust
SplunkTrust

@zacksoft

Can you please try this?

BASE_SEARCH 
| eval bucket = case(server_respond<1,"Bucket 1", (server_respond > 1 AND server_respond < 10),"Bucket 2", 1=1,"Bucket 3")
| stats count(web-calls) as web-call-count by bucket 
| eventstats sum(web-call-count) as total 
| eval percentage=round((web-call-count*100/total),2) 
| table bucket percentage

zacksoft
Contributor

Thank you . It works.

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@zacksoft

Great!! Can you please upvote and accept the answer to close this question?

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