Splunk Dev

Can you provide a Splunk search to find the count of total and failed events?

sahil237888
Path Finder

Can you provide a Splunk query to find the count of Total number of events (where field1 = "News") and out of total how many numbers are failed events (where field1 = "News" and field4 = "Media" both)

Tags (1)
0 Karma

sgundeti
Path Finder

simulating your requirement

 | makeresults count=100 | eval field1="News" | appendcols [ | makeresults count=10| eval field4="Media" ] | stats count(eval(field1="News")) as f1 count(eval(field1="News" AND field4="Media")) as f4

results as

f1  f4
100 10

In your case, try like this

... field1="News" OR field4="Media" | stats count(eval(field1="News")) as Total count(eval(field1="News" AND field4="Media")) as "failed events"
0 Karma

whrg
Motivator

If two queries are fine (one for total count and one for failed ount) then you can search for:

index=... ... field1="News" | stats count

and

index=... ... field1="News" field4="Media" | stats count

If you require only one search then do it as follows:

index=... ... field1="News" | stats count as total_count count(eval(field4=="Media")) as failed_count
0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...