Splunk Search

[Search] Avg failed logins by user per day

test_qweqwe
Builder
sourcetype=linux_secure |rex "\w{3}\s\d{1,2}\s\d{2}:\d{2}:\d{2}\s\S+\s(?<session>gdm-\w+)\S:\s"| search session=gdm-password | rex "\w{3}\s\d{1,2}\s\d{2}:\d{2}:\d{2}\s(?<hostname>\S+)\s.+\Sgdm-password:auth\S:\s(?<authstatus>\w+\s\w+);\s.+user=(?<username>\S+)" | search authstatus="authentication failure" 

it's shows me all failed auth users on machine and I don't know how to property continuum this search to show avg failed logins by user per day

0 Karma
1 Solution

MonkeyK
Builder

so you already have username and _time. you should be able to do something like this:

base search | bin _time as date span=1d |  stats count by username date| stats avg(count) by username

The first stats will give you daily counts. The second one will average them.
I am not sure if there is a way to combine the two stats commands, so maybe someone else will have something more elegant

View solution in original post

MonkeyK
Builder

so you already have username and _time. you should be able to do something like this:

base search | bin _time as date span=1d |  stats count by username date| stats avg(count) by username

The first stats will give you daily counts. The second one will average them.
I am not sure if there is a way to combine the two stats commands, so maybe someone else will have something more elegant

Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...