如何从此路径获取日志:应用程序和服务 -> microsoft ->windows -> ...
像这个事件日志路径
我写了这段代码,但它不适用于这条路径我还从 eventlog 中获取了 logtype ...
server = 'localhost' # name of the target computer to get event logs
logtype = "Microsoft-Windows-Dhcp-Client/Admin" # 'Application' # 'Security' #'System'
hand = we.OpenEventLog(None,logtype)
flags = we.EVENTLOG_FORWARDS_READ|we.EVENTLOG_SEQUENTIAL_READ
while True:
events = we.ReadEventLog(hand, flags,0)
if events:
for event in events:
Source_Name = event.SourceName