 |
|
 |
| |
Developer on focus
Anton Zamov is a dipl. engineer with more than 6 years of active professional
experience and many awards ...
read more>>
|
|
 |
 |
 |
|
 |
|
 |
| |
|
How to read data from the Windows event log?
|
use Win32::EventLog;
# each event has a type, this is a translation of the common types
%type = (1 => "ERROR",
2 => "WARNING",
4 => "INFORMATION",
8 => "AUDIT_SUCCESS",
16 => "AUDIT_FAILURE");
# if this is set, we also retrieve the full text of every
# message on each Read( )
$Win32::EventLog::GetMessageText = 1;
# open the System event log
$log = new Win32::EventLog("System")
or die "Unable to open system log:$^E\\n";
# read through it one record at a time, starting with the first entry
while ($log->Read((EVENTLOG_SEQUENTIAL_READ|EVENTLOG_FORWARDS_READ),
1,$entry)){
print scalar localtime($entry->{TimeGenerated})." ";
print $entry->{Computer}."[".($entry->{EventID} &
0xffff)."] ";
print $entry->{Source}.":".$type{$entry->{EventType}};
print $entry->{Message};
}
|
About the author of this programming example or tutorial:
Anton Zamov is a software engineer with more than6 years
of active experience in web and software development and design.
Anton Zamov has extensive experience and broad knowledgebase
in C# and JAVA programming and has created a lot of
running e-commerce systems, portals and content management
systems using PHP and other web development technologies.
For more information about Anton Zamov, you may visit the personal web site of
Anton Zamov.
|
|
|
 |
 |
 |
|
|