Reporting

Dynamically generate user login failures

oanyanetu
Loves-to-Learn Lots

Hello.

I am trying to compute a user's login failure rate so I can pit that against their daily failure rate to see if they're staying within their expected behavior. 

The problem is that a user may not login everyday so something like

 

...  | eval av=(FailedLogin/7)

 

won't work if a user does not login everyday.

Is there a way to say

 

|eval _counter="0"
|eval if(FailedLoginForThisDay!="0") counter = counter + 1
|span -1d
|eval avg = (FailedLoginTotal/counter)
|eval if(avg < FailedLoginForThisDay) stats count by user, ipaddr, etc

 

where I am saying iterate over a set of days and determine if a user had a failed login. If so increment the counter, do it in 1 day buckets (is there a better way?) then finally take my counter, find my true average for failed logins and if they are above their average print out their username, ip, and other stats.

 

 

Labels (1)
0 Karma

t_shreya
Path Finder

Hi,
I think the following query may help.

...| bin span=1d _time 
| eventstats count as FailedLoginForThisDay by user,_time 
| eventstats avg(FailedLoginForThisDay) as avg_failed_logins by user
| where avg_failed_logins < FailedLoginForThisDay
| table user, ipaddr, ...

 

where,

bin span=1d _time

 would help divide the data into 1 day buckets,

 

eventstats count as FailedLoginForThisDay by user,_time

 would calculate the number of failed logins per day and user

 

eventstats avg(FailedLoginForThisDay) as avg_failed_logins by user

 would calculate the average failed logins per user

Thanks.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Persistent Queue at TcpOut — One of Splunk's Most Practical Features

Splunk introduced persistent queueing at the tcpout layer as one of the most practical resilience features in ...

Skip the Awkward Silence: Have a .conf-ersation at .conf26

Picture this. You arrive at .conf26 already having your socializing and networking plans mapped out. No ...

Rethinking Zero Trust: From Product Purchases to Logical Control Evidence

Implementing Zero Trust (ZT) across complex environments often falters at the very beginning due to a ...