[python-win32] Python parser for Windows Event Logs
Mark Hammond
skippy.hammond at gmail.com
Sun Jul 12 03:32:53 CEST 2009
Check out the ReadEventLog code in win32evtlogutil.py - you will notice
you need a loop like:
while 1:
objects = win32evtlog.ReadEventLog(h, readFlags, 0)
if not objects:
break
Mark
On 11/07/2009 1:38 PM, Tony Cappellini wrote:
> 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
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
More information about the python-win32
mailing list