Hi Everyone! I'm newer to Log Parser and have been wracking my fingers over this. I'm looking to parse Windows Event Log files and I'm hoping to find a method using Log Parser that allows me to customize (filter/parse) the Message field in the output file generated.
For example, if I want logon records 528 I use:
"SELECT Message INTO report.csv FROM SecEvent.Evt WHERE EventID=528"
But I don't want everything in the description field for the record. I only want: time generated, user name and domain. So I modify my command to:
"SELECT TimeGenerated, EXTRACT_TOKEN(Strings, 0, '|')AS UserName, EXTRACT_TOKEN(Strings, 1, '|')AS Domain INTO report.csv FROM SecEvent.Evt WHERE EventID=528"
The above gives me my CSV file with the time generated, the user account and domain. But the key piece of information I want is the first line of the Message (description) field in the event record: that of "Successful Logon:".
Thus far I have not found a way to parse the Message field to pull this first line. 0 is for the user name, 1 for the domain, 2 for the logon ID, etc., in the Security event log.
Is there a way to use Log Parser to parse the Message field in the event log to pull this "first" line? I quote first because it's the very first line of text displayed in the event viewer event properties window, followed by the user name, domain, etc.
Currently I'm outputting the entire Message field to a CSV file, then using OpenOffice to find and replace all the information I don't want. Not slow, but would like to know if Log Parser can write out what I want and only what I want.
Has anyone ideas or know how to get that first bit of information from the Message (description) field of event logs using Log Parser (along with the other two fields (strings) I'm interested in?
Cheers!
LT