0
我想读一个存档的Windows事件日志文件(.evtx
),就像在这个例子中为Windows事件日志消息的模板:如何获得
using System;
using System.Diagnostics.Eventing.Reader;
public static class Program {
static void Main(string[] args) {
using (var reader = new EventLogReader(@"C:\tmp\some-log.evtx", PathType.FilePath)) {
EventRecord record;
while ((record = reader.ReadEvent()) != null) {
// do something with record...
}
}
}
}
的record
对象有一个Properties
列表包含替换字符串的事件:
foreach (var property in record.Properties) {
Console.WriteLine(property.Value);
}
如果我打开.evtx
文件在事件日志查看器,我可以看到一个完整描述的事件,它就像一个基本模板消息(应该来自resourc与这些值替换占位符的值相关联,以生成该事件的应用程序ES文件):
有没有一种方法,我可以得到一定的情况下,本“消息模板”?
通过任何来源,你知道这些元数据被保存在Windows? – Vesper