如何将Microsoft-Windows-TerminalServices-RemoteConnectionManager%4Operational里面的日志提取成csv格式进行分析
Hi jiawei.peng,
主要问题还是如何读取, 你可以尝试使用
EventLogQuery(System.Diagnostics.Eventing.Reader
namespace)去读取。读取内容后,自己去生成CSV文件。
using System.Diagnostics.Eventing.Reader;
string logType = "Microsoft-Windows-TerminalServices-RemoteConnectionManager/Operational";
string query = "*[System/EventID=1149]";
var elQuery = new EventLogQuery(logType, PathType.LogName, query);
var elReader = new EventLogReader(elQuery);
List<EventRecord> eventList = new List<EventRecord>();
for (EventRecord eventInstance = elReader.ReadEvent(); eventInstance != null; eventInstance = elReader.ReadEvent())
{
// .. do stuff here
//Access event properties here:
//eventInstance.LogName;
//eventInstance.ProviderName;
eventList.Add(eventInstance);
}
下面一篇英文文章也许能帮助你。
Accessing Application and Service logs with C#:
Best regards
Yong Lu
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
MSDN Support, feel free to contact MSDNFSF@microsoft.com.