This is fairly easy to do with the API provided by Log Parser.
Download and Install Log Parser 2.2
Add a link to the COM library "MS Utility 1.0 Type Library - LogParser Interface Collection". Searching for a magazine has significantly shortened the list.

Change the Reference properties so that it does not embed Interop types. If you do not, you will get compilation errors as follows: Interop type "MSUtil.COMCSVOutputContextClassClass" cannot be embedded. Use the appropriate interface instead.

The contents of the LogParser help file has a great API link, but I included parts that I used inline with the code.
using System; using MSUtil; namespace LogParserTest { using LogQuery = LogQueryClassClass; using EventLogInput = COMEventLogInputContextClassClass; using CSVOutput = COMCSVOutputContextClassClass; using XMLOutput = COMXMLOutputContextClassClass; class Program { static void Main(string[] args) { try {
source share