c# Read real time from windows event log
问题 i can succesfully read events from event log. But polling all events has very bad performance. I wonder if there is an event or something that i can subscribe to catch log entries "as they happen"? Is this possible? EventLog log = new EventLog("Security"); var entries = log.Entries.Cast<EventLogEntry>().Where(x => x.InstanceId == 4624).Select(x => new { x.MachineName, x.Site, x.Source, x.UserName, x.Message }).ToList(); Console.WriteLine(entries[0].UserName); 回答1: You can use EventLogWatcher