Read the windows event log

Austin austin at maxtronic.com.tw
Tue Apr 12 23:04:27 EDT 2005


My codes are below:

***********************************
import win32evtlog

def check_records(records):
    for i in range(0,len(records)):
        print records[i].SourceName

h = win32evtlog.OpenEventLog(None,"System")
flags = 
win32evtlog.EVENTLOG_BACKWARD_READ|win32evtlog.EVENTLOG_SEQUENTIAL_READ
records = win32evtlog.ReadEventLog(h,flags,0)

print "Total " + str(len(records))
check_records(records)

************************************

The result from my codes are total 2.
But the event log in windows event viewer are 24.
How could I get all events? 





More information about the Python-list mailing list