Splunk Search

Query to get top 5 failures

s_kandula
Observer

I have events being sent to Splunk which will have the following fields
MsgID, Status(Failure/Success)
I need to get the list of top 5 MsgIDs with maximum failures. And display each of the 5 MsgIDs in a pie chart, with success and failure percentages.

I am able to get the top 5 failures, but unable to figure out how to get both success and faliures as percentages for top 5 failures.
Please help

Tags (2)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

This query will give you successes and failures as percentages, but I don't know a way to get both into the same pie chart.

... | stats count as Total, count(eval(Status=="Failure")) as Failures, count(eval(Status=="Success")) as Successes by MsgID
| sort 5 - Failures
| eval PctFailure = Failures * 100 / Total, PctSuccess = Successes * 100 / Total
| chart PctFailure by MsgID
---
If this reply helps you, Karma would be appreciated.

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

This query will give you successes and failures as percentages, but I don't know a way to get both into the same pie chart.

... | stats count as Total, count(eval(Status=="Failure")) as Failures, count(eval(Status=="Success")) as Successes by MsgID
| sort 5 - Failures
| eval PctFailure = Failures * 100 / Total, PctSuccess = Successes * 100 / Total
| chart PctFailure by MsgID
---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...

September Community Champions: A Shoutout to Our Contributors!

As we close the books on another fantastic month, we want to take a moment to celebrate the people who are the ...

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...