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)
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Observability Simplified: Combining User Experience, Application Performance & ...

Tech Talk Observability Simplified: Combining User Experience, Application Performance & Network ...

Event Series May & June: From Network Visibility to Service Intelligence

Unifying the Network: Moving from Alert Noise to Service Intelligence with Splunk ITSI In today’s hybrid ...