Hello everyone,
The problem witht the script below is that when an eventlog (i.e.
application) contains
more than, aprox. 3000 events, the  $handle->Read() request fails for any
events inside that eventlog. The machines tested either run NT 4 or Win2k.
Is it possible that the request fails because of the size of the eventlog?
Thank you for your concern,

Francois

<code>
$handle=Win32::EventLog->new("System", $ComputerName)
        or die "Can't open Application EventLog\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";

#               Format the date for text
                ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
=localtime($hashRef->{'TimeGenerated'});
                $mon++;
                $year+=1900;

#               to get a readable EventID
                $event_id= $hashRef->{'EventID'}  & 0xffff;

                #readable EventType
                $event_type = $EventType{ $hashRef->{'EventType'} };
                
                $eventDate = "$mon/$mday/$year";
                $eventTime = "$hour:$min:$sec";

                #print "$x Date: $eventDate Time:$eventTime Event:$event_id 
Source:$hashRef->{Source}\n";

        $x++;
}
</code>
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to