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!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...