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!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...