问题描述
在使用Windows Event Collector时寻找更多信息或至少对EventRecordID的替代方案作为索引提出建议。
当使用单个服务器和单个Eventlog时,EventRecordID元素可以用作索引,以按顺序爬网事件时保持位置。
但是,使用Windows事件收集器时,事件在ForwardedEvents日志中保留其原始EventRecordID。这样一来,使用脚本/程序在事件中进行爬网时,充其量就很难保持跟踪。
日期/时间戳也无济于事,因为经过指定的日期/时间之后,事件可能会从其他系统传入。
有人对在ForwardedEvents中跟踪,添加书签或建立索引事件有什么建议吗?
解决方法
您可以使用书签 ID
See how to get it with the Microsoft example in C++ here
或者像我在 C# 中所做的那样
EventLogQuery eventsQuery = new EventLogQuery("ForwardedEvents",PathType.LogName);
EventLogReader logReader = new EventLogReader(eventsQuery);
EventRecord myevent = logReader.ReadEvent();
string bookmark = ReflectionHelper.GetPropertyValue(myevent.Bookmark,"BookmarkText").ToString();