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!

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...

Announcing the Migration of the Splunk Add-on for Microsoft Azure Inputs to ...

Announcing the Migration of the Splunk Add-on for Microsoft Azure Inputs to Officially Supported Splunk ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI! Discover how Splunk’s agentic AI ...