473,471 Members | 1,684 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Read the windows event log

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
1 5423
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: sumGirl | last post by:
Anyone nkow how to read the windows system event log from SQL server? Preferably an sp I guess.
18
by: jas | last post by:
Hi, I would like to start a new process and be able to read/write from/to it. I have tried things like... import subprocess as sp p = sp.Popen("cmd.exe", stdout=sp.PIPE)...
5
by: RAJ | last post by:
hi plz tell me how to know "how window is going to close"... i have to right code for X button of forms... plz telll me thanks bye
7
by: JerryW | last post by:
I just reinstalled .NET 2003 (after repeated attempts to get ASP.NET Web Applications to work). I first did a complete uninstall of .NET 2003, .NET Framework 1.1, and IIS. I also completely deleted...
2
by: nekiv90 | last post by:
Greetings, How can 'rows read' from a DB2 CALL statement incur so many reads? I would expect it to be zero. Could someone enlighten me on this? Thanks! Here is output from executing event...
4
by: Seok Bee | last post by:
Dear Experts, I have created a script to extract the Event Logs from the system into an excel sheet. The logs are separated into 2 worksheets (Application Log and System Log). After this excel...
7
by: sergio-p | last post by:
I had no luck in my google search for this answer. Does anyone know if it's possible to read the entries in the Windows Event Log of the server running my PHP page? I'm trying to create an itranet...
1
by: Marc Bartsch | last post by:
Hi, My C# app throws the following exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. From...
23
by: Dan Tallent | last post by:
A textbox has a attribute for ReadOnly. This seems like such a simple concept. When a textbox is set to read only the user cannot change the contents of the field. I have been trying to find...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.