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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...