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
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).
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!