By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,523 Members | 1,737 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,523 IT Pros & Developers. It's quick & easy.

Read the windows event log

P: n/a
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.EVE NTLOG_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?
Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
You'll need to read in a loop until no records are returned.

Roger

"Austin" <au****@maxtronic.com.tw> wrote in message
news:d3**********@netnews.hinet.net...
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.EVE NTLOG_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?



----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.