All,
I am at a loss. I am trying to pull EventCode 642 and 4738 so i can identify when a user account has been changed.
I currently have;
sourcetype="WinEventLog:Security" EventCode="642" OR EventCode="4738" | rex "(?ms)A user account was changed.+?Display Name:\s(?<wanted_user>\V+)" | table _time Display_Name Account_Name ComputerName
It works, but... There are two Account Name in the 642/4738 event logs. Our Display Name wasn't populated like it should be within AD so i don't get much useful information from it.
What I would like to see is:
_time "Account name that was changed" "Account name of the person who changed it" and the ComputerName.
Any help would be much appreciated!
You are best off pulling samples of each and using the wording on the events, and your resulting knowledge of what fields are populated in your particular environment, to pull information off the events via rex.
The standard general wording for each is here, but it occasionally varies based on specific OS version.
https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=642
https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=4738
For instance, this pulls the Target account name off of the standard 528 and the 4738 events, respectively. Since the words "Account Name" occur twice, you need to take the second occurrence as the target account. This is one way to do that.
| rex "Target Account Name:\s+?(<TargetName>[^\s]*)"
| rex "Account Name:\s+?(<AccountName>[^\s]*) max_match=2
| eval TargetName=coalesce(TargetName,mvindex(AccountName,1))