Splunk Search

Alert for events over a certain amount and over a certain percentage change

jwalzerpitt
Influencer

I am trying to create an alert which will notify me when the percentage change in the delta/difference of events exceeds 100% (minimum of 10 events as I want to try and eliminate the influence of low numbers on the percentage change, i.e., going from 1 event to 6, etc.)

My search query as follows:

index=indexname earliest=-1h Subject="xzy" SenderAddress="xyz@xyz.edu"
| timechart span=1h partial=false count
| delta count as difference
| eval difference=coalesce(difference,0)
| eval percentDifference =round(abs(difference/(count - difference))*100)
| where (difference > 1 AND percentDifference > 100)
| where count > 10

Just wanted to see if a) there was a more efficient way to run this query and b) confirm that this search should be ran every hour and 10 minutes or so (there is a lag time of the logs flowing in that's about 10 minutes behind).

Thx

0 Karma
1 Solution

woodcock
Esteemed Legend

You can use index_earliest and index_latest to help cover late arriving events.

View solution in original post

woodcock
Esteemed Legend

You can use index_earliest and index_latest to help cover late arriving events.

jwalzerpitt
Influencer

Plugged the following into the query to search for events indexed in the previous hour:

index=indexname _index_earliest=-h@h _index_latest=@h Subject="xzy" SenderAddress="xyz@xyz.edu"

0 Karma

jwalzerpitt
Influencer

Awesome - thx!

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

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