我正在尝试从事件查看器中复制以下内容:
我有几个问题遇到了困难。
- Some of the names I get back are not the display names or friendly names. For example, for "Microsoft Office Alerts" I just get back "OAlerts". How can I get the full "Microsoft Office Alerts" from "OAlerts"?
Figuring out the hierarchy. It seems all I can do is parse out the dashes and do some sort of a best guess. There doesn't seem to be an easy way in the API to figure it out. The
GetLogNames
just gives you a flat list of all the logsEventLogSession session = new EventLogSession(); List<string> logNames = new List<string>(session.GetLogNames()); foreach (string name in logNames) { //EventLogConfiguration config = new EventLogConfiguration(name); //looks useful but doesn't give me any of the info i'm looking for. Console.WriteLine(name); }
new ProviderMetadata("Microsoft-Windows-IIS-Configuration", session, null).LogLinks
发现该链接)。日志和其提供程序之间的命名空间并不总是一致的... - Simon Mourier