Splunk Search

How do you send an alert when the number of records goes below 20% of the daily avg?

navd
New Member

Hi ,

I am using the below query to get an average count . But how do I write a query to send an alert when the number of records goes below 20% of the daily average?

index= abc platform=xyz | stats avg(count) by _time
Tags (2)
0 Karma

woodcock
Esteemed Legend
0 Karma

somesoni2
Revered Legend

Assuming you're running the alert daily to compare yesterday's (full day) count to check if it was less than daily average count over last 7 day (or 7 days prior to yesterday), try something like this (timerange selected to include data for past 8 days, excluding today):

index=abc platform=xyz earliest=-8d@d latest=@d | timechart span=1d count
| eval yesterday=if(_time=relative_time(now(),"-1d@d"), count, null())
| eval lastweek=if(_time<relative_time(now(),"-1d@d"), count, null())
| stats values(yesterday) as yesterday avg(lastweek) as dailyavg
| where yesterday<=0.8*dailyavg
0 Karma

navd
New Member

@somesoni2
I tried using the above query , but It don't see any results .

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...