Getting Data In

Evaluating a custom formula in Splunk

vijaybhat85
New Member

In our application we log the response statuses in Splunk for all requests hitting our endpoint, something along the lines of "response status for the request was 200 OK". In case of a failure the response status changes to "response status for the request was 500 Internal Error" , "response status for the request was 404 Not Found", etc. I want to compute a success rate for the application. Basically its a ratio of all "200 OK" to the sum total of all requests logged, something like (http_200 / http_all) * 100. Any ideas on the best way forward for this. I tried using eval but am stuck in terms of evaluating two different result sets and the subsequent ratio computation.

Tags (1)
0 Karma

kmorris_splunk
Splunk Employee
Splunk Employee

Try something like this:

sourcetype=access_combined 
| stats count(eval(action="remove")) as remove_count count as all_count 
| eval remove_ratio_%=round(((remove_count/all_count)*100),0)
Get Updates on the Splunk Community!

Splunk MCP & Agentic AI: Machine Data Without Limits

  Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization ...

Finding Based Detections General Availability

Overview  We’ve come a long way, folks, but here in Enterprise Security 8.4 I’m happy to announce Finding ...

Get Your Hands Dirty (and Your Shoes Comfy): The Splunk Experience

Hands-On Learning and Technical Seminars  Sometimes, you just need to see the code. For those looking for a ...