Splunk Search

Summarizing results of a search by system

billbender
Engager

We have a batch search that looks for password changes on Windows boxes that happened "yesterday" and sorts the results by what system the change took place on.

"Change Password Attempt" OR "attempt was made to change" | rex "Caller User Name:\s(?<Caller_User_Name>\S+).*" | rex "Target Account Name:\s(?<Target_Account_Name>\S+).*" | sort host 

The results are mailed out in a spreadsheet to be reviewed.

If a user has more than 1 password change on a system I would like to be able to have the results show a summary indicating that the user had x password changes rather than multiple lines each listing 1 occurrence of a change. I still want the results to be separated by host, so if a user changed their password on more than one system, they will show up under each system as having changed their password x times on that system.

Thanks, Bill

Tags (2)
1 Solution

Lowell
Super Champion

Sounds like a simple stats command is all you need.

Try this:

"Change Password Attempt" OR "attempt was made to change" | rex "Caller User Name:\s(?<Caller_User_Name>\S+)" | rex "Target Account Name:\s+(?<Target_Account_Name>\S+)" | stats count by Target_Account_Name, Caller_User_Name, host | sort host

BTW, your search would be faster if you include some kind of source/sourcetype as part of your search criteria. Probably something like: sourcetype=WinEventLog:Security

View solution in original post

0 Karma

Lowell
Super Champion

Sounds like a simple stats command is all you need.

Try this:

"Change Password Attempt" OR "attempt was made to change" | rex "Caller User Name:\s(?<Caller_User_Name>\S+)" | rex "Target Account Name:\s+(?<Target_Account_Name>\S+)" | stats count by Target_Account_Name, Caller_User_Name, host | sort host

BTW, your search would be faster if you include some kind of source/sourcetype as part of your search criteria. Probably something like: sourcetype=WinEventLog:Security

0 Karma

Lowell
Super Champion

You can give both of us some points by officially accepting this answer. Just click on the check on the side of this answer.

0 Karma

billbender
Engager

That worked like I was hoping, Thanks!

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...