Alerting

How to Throttle a Scheduled Alert by Field?

rackersmt
Explorer

Splunk receives logs from our domain controllers, and we're wanting to trigger on accounts that have an excessive number of lockout events (event code 4740). A real-time alert causes too much load on the search head because of all the 4740 events coming in (we're a very large organization). Therefore, I've switched to a Scheduled Alert that runs hourly with an action of sending an email. I'd like to not send the email if the account that's locked out has been alerted on in the last 24 hours. Since Scheduled Alerts can't seem to throttle by field, is there a way to alert only if new domain accounts how up in the report?

Here's the basic search I'm running for the alert without throttling:

index=[index-name] EventCode=4740 earliest=-24h | rex field=_raw "(?s)(?i)Account\sThat\sWas\sLocked\sOut.+?Account\sName:\s+(?\S*)" | search NOT acct_name="Guest" | top acct_name | where count >= 50 | sort -count

Thanks!

0 Karma
1 Solution

somesoni2
SplunkTrust
SplunkTrust

Try something like this.

index=[index-name] EventCode=4740 earliest=-25h | rex field=_raw "(?s)(?i)Account\sThat\sWas\sLocked\sOut.+?Account\sName:\s+(?\S*)" | search NOT acct_name="Guest" | eval Period=if(_time>relative_time(now(),"-1h"),"New","Old" ) | stats count values(Period) as Period by acct_name  | where mvcount(Period)=1 AND  Period="New" AND count >= 50| sort -count | head 10 | fields -Period

SInce, you're running the search every hour, the new lockouts will be there in last 1 hour period only, others would've been alerted during previous hour. So, above search check if the lockout has only happened in last 1 hr (period=New) with count>50.

View solution in original post

somesoni2
SplunkTrust
SplunkTrust

Try something like this.

index=[index-name] EventCode=4740 earliest=-25h | rex field=_raw "(?s)(?i)Account\sThat\sWas\sLocked\sOut.+?Account\sName:\s+(?\S*)" | search NOT acct_name="Guest" | eval Period=if(_time>relative_time(now(),"-1h"),"New","Old" ) | stats count values(Period) as Period by acct_name  | where mvcount(Period)=1 AND  Period="New" AND count >= 50| sort -count | head 10 | fields -Period

SInce, you're running the search every hour, the new lockouts will be there in last 1 hour period only, others would've been alerted during previous hour. So, above search check if the lockout has only happened in last 1 hr (period=New) with count>50.

rackersmt
Explorer

Beautiful, thank you!

0 Karma
Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...