Read the Windows event log for a specific source

How can I read the Windows event log for a specific source, date and category?

+3
source share
3 answers

You can use additional software called " Log Parser "

Comes with an API that you can use after it has installed the help file :)

0
source

Consider using the EventLog Class .

EventLog allows you to access or configure Windows Event Logs, which record information about important software or hardware events. Using EventLog, you can read from existing logs, write log entries, create or delete event sources, delete logs, and respond to log entries. You can also create new logs when creating a source event.

0
source

I know this question is very old, but today I spent a lot of time creating a solution for this, so I thought that I would share:

Dim myEventLogEntryCollection As EventLogEntryCollection = New EventLog("Application", System.Environment.MachineName).Entries Dim myEventLogEntryArray(myEventLogEntryCollection.Count - 1) As EventLogEntry myEventLogEntryCollection.CopyTo(myEventLogEntryArray, 0) Dim QueryLog As System.Linq.IQueryable(Of EventLogEntry) = myEventLogEntryArray.AsQueryable QueryLog = QueryLog.Where(Function(i As EventLogEntry) i.Source = "MyParticularSourceName") For Each Entry As EventLogEntry In QueryLog '... your code goes here Next myEventLogEntryCollection = Nothing myEventLogEntryArray = Nothing 

Hope this helps others!

0
source

All Articles