Dashboards & Visualizations

Results of 2 query in Pie Chart

motupaul
New Member

Hi All,

I am looking for pie chart which number success & Error events in the search. Below are my 2 query's.

Query 1 :- host = servername sourcetype=file index=index_prod "ERROR" | stats count
Query 2 :- host = servername sourcetype=file index=index_prod "Success" | stats count

Initially i though to extract the field, But the in the event "Error" & "Success" falls on different fields. Can some please suggestion an idea.

Tags (1)
0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

Chart this as a pie:

host = servername sourcetype=file index=index_prod ("ERROR" OR "SUCCESS") | eval class = if(searchmatch("ERROR"), "ERROR", "SUCCESS") | stats count by class

Combining the two searches will also give you a performance boost 🙂

Note, I've assumed that events containing both ERROR and SUCCESS will only be counted as ERROR.

View solution in original post

0 Karma

motupaul
New Member

Thank you very much

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Chart this as a pie:

host = servername sourcetype=file index=index_prod ("ERROR" OR "SUCCESS") | eval class = if(searchmatch("ERROR"), "ERROR", "SUCCESS") | stats count by class

Combining the two searches will also give you a performance boost 🙂

Note, I've assumed that events containing both ERROR and SUCCESS will only be counted as ERROR.

0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...