Splunk Search

Failed Login Query

Mmilaham
Loves-to-Learn

Hello,

I am trying to write a query that will display failed logins (Account_Name, Host, Count).

First Query

index=wineventlog EventCode=4625 | top limit=20 Account_Name host  | where count > 9

Con

1. Displays "-" in some of the Account_Name fields 

Mmilaham_0-1639775438530.png

Pro

1. Displays all the count and host fields correctly.

Second Query

index=wineventlog EventCode=4625  | rex "(?ms)Account For Which Logon Failed.+?Account Name:\s+(?<Account_Name>\V+)" |top limit=30 Account_Name host| where count >=9

Con

Displays all the Account_Name, count and host fields correctly but displays a lot less results on the table compared to the first query.

 

Pro

Displays all the Account_Name, count and host fields correctly

 

I need a query that will displays all the Account_Name, count and host fields correctly as well as displays the same amount of results in the first query. Any help is appreciated. Thanks in advance. 

 

Labels (3)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Once you start filtering out undesired account names the number of results will change.  Perhaps this is more like what you're looking for.

 

index=wineventlog EventCode=4625 Account_Name!="-" ```Filter out -```
```Count names```
| stats count by Account_Name host
```Filter out accounts with fewer than 10 failures```
| where count > 9
```Sort in descending order by count and take the top 20 results```
| sort 20 - count

 

---
If this reply helps you, Karma would be appreciated.
0 Karma

Mmilaham
Loves-to-Learn

I'm still getting fewer result compared to running the first query. Also some of the Account Name are wrong(It's just displaying the Host name).

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Like I said, it's not possible to discard some results and still end up with the same number of results.

The stats command should not be returning results with just the host name in them.  Please share your output (sanitized as necessary).

---
If this reply helps you, Karma would be appreciated.
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...