Splunk Dev

Unable to get multiple failed logins followed by successful login

gadepoonam
Explorer

In order to get Unable to get multiple failed logins followed by successful login, i have written following search query.

But looks like matchCount is not working fine. The transaction query is able to list the events correctly, but stats is not giving correct count. Plus the number of records written by stats is not correct. I am looking for only those records which have Failed count > 0

index=rhel sourcetype=linux_secure process=sshd | transaction pid host endswith="Accepted password"
| stats count(eval(searchmatch("Failed password"))) as FailedCount by user _time

Tags (1)
0 Karma

somesoni2
Revered Legend

Try this

index=rhel sourcetype=linux_secure process=sshd 
| eval Failed=if(searchmatch("Failed password"),"Failed",null())
| transaction pid host endswith="Accepted password" 
| stats count(Failed) as FailedCount by user _time

gadepoonam
Explorer

Thanks for your response. But I am facing same issue as above with new query.

For example, please find below event log which shows Failed password was entered twice. But stats shows failed count as 1

Event Logs:
7/28/17
8:59:30.000 AM

Jul 28 06:59:30 <> sshd[12314]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=<> user=xyz
Jul 28 06:59:32 <> sshd[12314]: Failed password for xyz from <> port 56814 ssh2
Jul 28 06:59:36 <> sshd[12314]: Failed password for xyz from <> port 56814 ssh2
Jul 28 06:59:43 <> sshd[12314]: Accepted password for xyzfrom 10

Stats:
User _time FailedCount
xyz 2017-07-28 08:59:30 1

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...