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!

Celebrating Fast Lane: 2025 Authorized Learning Partner of the Year

At .conf25, Splunk proudly recognized Fast Lane as the 2025 Authorized Learning Partner of the Year. This ...

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...