[python-win32] Python parser for Windows Event Logs

Tony Cappellini cappy2112 at gmail.com
Sat Jul 11 05:38:08 CEST 2009


Ok, I'm able to parse Event51 logs now.

However, there seems to be a problem with the  object returned from
ReadEventLogs()

GetNumberOfEvents() tells me there are 6 events.

I can see all sixe events using the EventViewer in Control Panle, on Widnwos XP.

However, the iterator returned from RedEvent Log() is consumned after
only 3 events.

    hand=win32evtlog.OpenBackupEventLog(None,logFilename)
    numEvents=win32evtlog.GetNumberOfEventLogRecords(hand)
    print'\n\t%lu events were found' % numEvents
    flags = win32evtlog.EVENTLOG_BACKWARDS_READ|win32evtlog.EVENTLOG_SEQUENTIAL_READ
    events=win32evtlog.ReadEventLog(hand,flags,0)

    for ev_obj in events:
         #stops iterating after only 3 events

Would someone verify this?

I see this problem on Python 2.3 and 2.5.4, with Pywin32 Build 213


Thanks

Tony


More information about the python-win32 mailing list