Splunk Search

How to edit my search to alert if there are 300,000 less events within a 1 hour period?

mcbradford
Contributor

I have the following search:

| metadata type=sourcetypes| stats sum(totalCount)

I want to be alerted if within a one hour period, there are 300k less events. I was using the drops by, but with the search above, there is only one event (the sum of the total count).

Thoughts?

Tags (3)
0 Karma

LukeMurphey
Champion

You can setup a search that returns nothing unless the count if less than 300000 and then use an alert. You can easily make this in the Manager UI too.

Here are some details:

Make the search logic

Create a search that return nothing unless the count hits the threshold.

| metadata type=sourcetypes| stats sum(totalCount) as count | where count < 300000

Schedule search

Schedule the search to run every hour and over a one hour period. This will generate an alert every hour but you could actually have it run more frequently.

Setup alert

Setup the alert to only trigger if at least on result is generated. That way, you won't get an alert unless the count is below your threshold.

Sample search

Here is my version of the search (not extensively tested though):

[Alert: event count low]
alert.digest_mode = True
alert.suppress = 0
alert.track = 0
auto_summarize.dispatch.earliest_time = -1d@h
counttype = number of events
quantity = 0
relation = greater than
cron_schedule = 0 * * * *
dispatch.earliest_time = -60m
dispatch.latest_time = now
enableSched = 1
search = | metadata type=sourcetypes| stats sum(totalCount) as count | where count < 300000
0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...