How to open saved event log archive in .NET?

Brian picture Brian · Jun 8, 2010 · Viewed 7k times · Source

I have used the System.Diagnostics.EventLog to view the logs on the local computer. However, I would like to open a saved event log archive (.evt or .evtx) and view the logs that are contained in the saved file. I just need to view timestamps, messages, sources, etc. associated with the logs in the file. Can this be done in C#?

Answer

Chris Dwyer picture Chris Dwyer · Jun 8, 2010

Check out the System.Diagnostics.Eventing.Reader namespace. Specifically the EventLogQuery class.

http://msdn.microsoft.com/en-us/library/bb671200(v=VS.90).aspx