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!

[Puzzles] Solve, Learn, Repeat: Reprocessing XML into Fixed-Length Events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

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