Splunk Search

How to calculate percentage by another field?

Hung_Nguyen
Path Finder

I would like to create a dashboard to show the percentage of each of my service meeting a certain performance requirement.  Each of the request access log entry would have field serviceName, txTime, and I would like to generate a table that show the percentage of requests meeting my SLA requirement of say 1000ms.  

The desired output would look something like

ServiceName                     Percentage
Service1                                98.9%
Service2                                99%

thank you

Labels (1)
0 Karma

yuanliu
SplunkTrust
SplunkTrust

How about 

| eval SLA = if(txTime < 1000, 1, 0)
| stats count sum(SLA) as meetSLA by serviceName
| eval Percentage = 100 * meetSLA / count
| fields - count, meetSLA
Get Updates on the Splunk Community!

Stay Connected: Your Guide to July Tech Talks, Office Hours, and Webinars!

What are Community Office Hours?Community Office Hours is an interactive 60-minute Zoom series where ...

Updated Data Type Articles, Anniversary Celebrations, and More on Splunk Lantern

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

A Prelude to .conf25: Your Guide to Splunk University

Heading to Boston this September for .conf25? Get a jumpstart by arriving a few days early for Splunk ...