Splunk Enterprise

Help with rule taking to long to run

Nath1
New Member

Hello, I have been asked to optimize this logic because is taking too long to run. I am not sure how else can I write to make it run faster. It's not throwing any errors it just takes a long time to run. Any help would be highly appreciate. 🙂 Thanks!

 

index IN (indexes) sourcetype=xmlwineventlog sAMAccountName IN (_x*, x_*, lx*, hh*)

| lookup mas_pam_eventcode.csv event_code AS EventCode OUTPUT action

| stats count(eval(action=="login_failure")) as failure_count, count(eval(action=="lockout")) as lockout_count by sAMAccountName

| where failure_count >= 3 OR lockout_count > 0

Labels (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

The query looks OK, but its speed also depends on how many events it is processing. Try running the search more often over a smaller time range.

Try to reduce "indexes" to the smallest set of indexes that contain relevant Windows events.

Consider removing the lookup and hard-coding the relevant event codes.

index IN (indexes) sourcetype=xmlwineventlog sAMAccountName IN (_x*, x_*, lx*, hh*)
| eval action = case(event_code=x, "login_failure",
                     event_code=y, "lockout")
| stats count(eval(action=="login_failure")) as failure_count, count(eval(action=="lockout")) as lockout_count by sAMAccountName
| where failure_count >= 3 OR lockout_count > 0
---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Index This | Why did the turkey cross the road?

November 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...