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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...