Splunk Search

Need search help

tkwaller
Builder

Hello

I have a search that timecharts useragent count by useragent. Simply
index=apache useragent=* | timechart count by useragent limit=100

what I would like to do is overlay a lower boundary so if the count in part of this span is lower than the boundary send an alert.
I tried this several different ways.

This was my last attempt:
index=apache* useragent=* | stats count as TotalCount, avg(TotalCount) AS AvgCount, perc5(TotalCount) by _time, useragent

Unfortunately I only get a TotalCount and nothing more.
Any ideas?
Thanks!

0 Karma
1 Solution

somesoni2
Revered Legend

Give this a try. This query will return result if the count value is lower than the 5 percentile value of the count.

index=apache* useragent=* 
| stats count as TotalCount by _time, useragent
| eventstats avg(TotalCount) AS AvgCount, perc5(TotalCount) as perc5Count
| where count < perc5Count

View solution in original post

somesoni2
Revered Legend

Give this a try. This query will return result if the count value is lower than the 5 percentile value of the count.

index=apache* useragent=* 
| stats count as TotalCount by _time, useragent
| eventstats avg(TotalCount) AS AvgCount, perc5(TotalCount) as perc5Count
| where count < perc5Count

tkwaller
Builder

Haha was just gettign there myself:
index=apache* useragent=* | timechart count by useragent | eventstats perc5(count) as Lower by useragent

was close at least.
Small changes

0 Karma
Get Updates on the Splunk Community!

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

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 ...