Splunk Search

Find count of "failures" in events

navd
New Member

I am running the following query , which is returning the number of events where "failures" keyword is occuring , but how can I find how many times "failures" keyword occured in each event

index=abc "failures"|stats count by host|eventstats sum(count) as totalCount

Tags (1)
0 Karma

pruthvikrishnap
Contributor

Hey Navd,
based on the scenario this search might work.
Do let me know if this is helping you.

index=abc sourcetype=xyz "failures"| rex max_match=0 "(?P<term>failures)" 
 | eval count=mvcount(term) 
 | stats sum(count) as Total by term
0 Karma

Ayn
Legend

You can do this by extracting all occurrences of the string "failures" to a field and then count all instances of that field:

index=abc "failures" | rex max_match=0 "(?<failures>failures)" | stats count(failures)
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 ...