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 App for Anomaly Detection End of Life Announcment

Q: What is happening to the Splunk App for Anomaly Detection?A: Splunk is officially announcing the ...

Aligning Observability Costs with Business Value: Practical Strategies

 Join us for an engaging Tech Talk on Aligning Observability Costs with Business Value: Practical ...

Mastering Data Pipelines: Unlocking Value with Splunk

 In today's AI-driven world, organizations must balance the challenges of managing the explosion of data with ...