Splunk Search

A user account was changed 4738 642

MrWh1t3
Path Finder

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!

0 Karma

DalJeanis
Legend

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))
0 Karma
Get Updates on the Splunk Community!

Index This | Why did the turkey cross the road?

November 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...