I found the solution. I had to replace line: | reverse with: | sort src_ip _time So that streamstats resets the counter each time the action is "success" for each src_ip. Working code: index=main sourcetype="wineventlog" EventCode IN (4624,4625) Logon_Type IN (2,3,8,10,11)
| eval action=if(match(Keywords,"Audit Failure"),"failed","success")
| sort src_ip _time
| streamstats window=0 current=true reset_after="("action==\"success\"")" count as failure_count by src_ip
| where action="success" and failure_count > 20
| table _time, user, src_ip, action, failure_count
... View more