I want to query the application event log on the remote machine, and I resorted to using EventLogReader and not EventLog because it takes a long time to find the events I need with EventLog . However, even though it finds events much faster using EventLogReader , I can't figure out where the hell the information I need is on this object ... especially on the message.
public static void Load() { string query = "*[System/Provider/@Name=\"SQLSERVERAGENT\"]"; EventLogQuery elq = new EventLogQuery("Application", PathType.LogName, query); elq.Session = new EventLogSession("xxxx"); EventLogReader elr = new EventLogReader(elq); _logEntries = new List<SqlEventEntry>(); EventRecord entry; while ((entry = elr.ReadEvent()) != null) { var Message = entry.???
c # event-log
Brandon moore
source share