Search code examples
c#c#-4.0event-log

Access to local Event Log in C#


I want to connect to local log and get some events from it.I use this code:

EventLog el = new EventLog();
el.Source = "";

But I don't know what is local EventLog source. Does anyone know what is the local source?


Solution

  • It depends from which log type you want to read. It could be Application, Security, Setup or System.

    You can see in the Event viewer the sources available:

    enter image description here