anton zamov it expert logo    

home page latest news web development curriculum vitae scripts contact me


  • Curriculum Vitae (CV)
  • Major web solutions
  • Web design projects
  • Software solutions


  • C# (Microsoft .NET)
  • JAVA
  • Dynamic HTML
  • PHP & MySQL
  • ASP.NET - C# & VB.NET
  • Perl & CGI
  • C | C++
  • Vector Markup Language
  • SMIL
  • Assembler
  • Databases
  • Wap Development
  • Web site promotion
  • Web Marketing




How to read data from the Windows event log?

(Perl free example written by Anton Zamov.)


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:$^En";

# 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};
}









Jobs Portal, poweful jobs board software

PHP Mall, multi vendors mall website software

Car Portal, php script for auto classifieds websites

NetArt Media, software products and services

Real Estate Portal, web software for real estate portals

Blog System, multi user blog hosting script

PHP Store, powerful e-commerce system written in PHP


C# (Microsoft .NET) | JAVA | Dynamic HTML | PHP & MySQL | Perl & CGI | C | C++ | Vector Markup Language
SMIL | Assembler | Databases | Wap Development | Web site promotion | Web Marketing

Copyright © Anton Zamov 1998 - 2023