[python-win32] Python parser for Windows Event Logs

Tony Cappellini cappy2112 at gmail.com
Sun Jul 12 06:41:04 CEST 2009


I'll give that a try.

I was using this for my reference
http://timgolden.me.uk/pywin32-docs/Windows_NT_Eventlog.html


On 7/11/09, Mark Hammond <skippy.hammond at gmail.com> wrote:
> 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