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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting V2

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...