Learning win32evtlog in python
WIn32evtlog is a module from pywin32 reading Windows Event Log. I found this library lack of examples, so I hope this page could help.
Getting Start
import win32evtlog
computer = None # None = Local
logType = "Security"
h=win32evtlog.OpenEventLog(computer, logType)
flags= win32evtlog.EVENTLOG_BACKWARDS_READ|win32evtlog.EVENTLOG_SEQUENTIAL_READ
evtLogs = win32evtlog.ReadEventLog(h, flags, 0)
evtLogs[0]
>>> <PyEventLogRecord at 0x221b8df0fd0>Reading PyEventLogRecord
evtLogs[0].SourceName
>>> 'Microsoft-Windows-Security-Auditing'List All Available Log Types
Getting Event Logs in XML format
Error Handling
Last updated