Regex Help Event ID 4720

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Regex Help Event ID 4720

L3 Networker

Im attempting to get out the email address listed as User Principal Name in a 4720 event ID

Any help or explanation would be appeeciated

 

dataset = xdr_data
| filter action_evtlog_event_id = 4720
| alter User_Name = arrayindex(regextract(action_evtlog_message, "New Account:\r\n.*\r\n.*Account Name:.*?(\w.*)\r\n"),0)
| alter Create_By = arrayindex(split(arrayindex(regextract(action_evtlog_message , "Account Name:\t\t.*\r\n"),0), ":"),1)
| alter New_Email = arrayindex(regextract(action_evtlog_message , "User Principal Name:\t.*"),2)
| fields agent_hostname, User_Name , Create_By , action_evtlog_event_id,New_Email, action_evtlog_message

2 REPLIES 2

L3 Networker

Hi NathanBradley,
I noticed for the arrayindex on the new_email field you have it set to 2, which would tell it to match on the third instance of the matched pattern. In my environment for event ID 4720 I only see one instance of the field "User Principle Name", so I would set the index value to 0 unless you are seeing something different for your events. Also as it stands, you are capturing the text "User Principle Name in addition to the value that would be in that field. Try replacing with the logic below.

| alter New_Email = arrayindex(regextract(action_evtlog_message , "User Principal Name:(\t.*)"),0).


Regards,
Ben

L3 Networker

Thanks, Yes that worked

Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!