RichardH has asked for the wisdom of the Perl Monks concerning the following question:
use Win32::EventLog; #print "comp name = ", $ENV{ComputerName}, "\n"; $myServer="\\\\<snip>"; print "\n$myServer\n"; $handle=Win32::EventLog->new("Application", $myServer) #$handle=Win32::EventLog->new("Application", $ENV{ComputerName}) or die "Can't open Application EventLog\n"; print "handle = $handle\n"; $handle->GetNumber($recs) or die "Can't get number of EventLog records\n"; $handle->GetOldest($base) or die "Can't get number of oldest EventLog record\n"; while ($x < $recs) { $handle->Read(EVENTLOG_FORWARDS_READ|EVENTLOG_SEEK_READ, $base+$x, $hashRef) or die "Can't read EventLog entry #$x\n"; if ($hashRef->{Source} eq "EventLog") { Win32::EventLog::GetMessageText($hashRef); print "Entry $x: $hashRef->{Message}\n"; } $x++; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reading win2000 application event logs with perl
by davemabe (Monk) on Jun 12, 2001 at 20:54 UTC | |
by RichardH (Sexton) on Jun 12, 2001 at 21:15 UTC | |
by Anonymous Monk on May 21, 2002 at 13:47 UTC |