What you see as EventLog is in reality a complex beast which is composed of many ETW (Event Tracing for Windows) Providers.
The code
foreach(var log in EventLogSession.GlobalSession.GetLogNames())
{
Console.WriteLine($"{log}");
}
gives you over 1000 entries. This are ETW providers with different channel settings which show up as "new" Event Logs since Windows Vista.
Before Windows Vista there were only the Event Logs
- Application
- Security
- System
and potentially a few others and some custon logs created by other applications. The data went into .evt Files where each Event Log has registered in the Registry the Event Sources and their resource dlls for message formatting and localization.
Since Vista and later versions this was reworked and under the hood now the "old" registry based approach is still there but most event log sources got in the regitry no longer an message dll but a reference to an ETW Provider id which is now looked up.
Hence your confusion when you did enumerate the EventLogSession which is a mixture of ETW providers and their configured channels which still can log to the Application event log.
The good old world with EventLog and its methods shows the "old" pre Vista View with log names and sources.
foreach(var log in EventLog.GetEventLogs())
{
Console.WriteLine($"{log.LogDisplayName}");
}
- Application
- Hardware Events
- Internet Explorer
- Security
- System
See my article https://aloiskraus.wordpress.com/2020/07/20/ms-performance-hud-analyze-eventlog-reading-performance-in-realtime/ for more information.