我想在远程计算机上查询应用程序事件日志,我使用了EventLogReader
而不是EventLog
因为使用EventLog
. 但是,即使它使用 更快地找到事件EventLogReader
,我也无法弄清楚我需要的信息在这个对象上的位置......尤其是消息。
public static void Load()
{
string query = "*[System/Provider/@Name=\"SQLSERVERAGENT\"]";
EventLogQuery elq = new EventLogQuery("Application", PathType.LogName, query);
elq.Session = new EventLogSession("x.x.x.x");
EventLogReader elr = new EventLogReader(elq);
_logEntries = new List<SqlEventEntry>();
EventRecord entry;
while ((entry = elr.ReadEvent()) != null)
{
var Message = entry.???
// I want process the message in the event here,
// but I can't find a property anywhere that contains the message??
}
}