in reply to Re: Win32::Eventlog Issues: Access Denied, Incorrect log size
in thread Win32::Eventlog Issues: Access Denied, Incorrect log size

Here's my two cents... Change the code around to suit your needs. This code will do away with opening a file of servers (nodes in my case), no sense in creating more files to make a mess of things? ya know?

By the way this has been tested on windows 2000 server 2000 pro and windows Xp

Hope it helps!
#!/usr/bin/perl -w use strict; use Win32::EventLog; my @nodes = qw(NODE1 NODE2 NODE3); foreach my $node(@nodes) { &GetEvents($node); } sub GetEvents { my($myServer) = @_; my($date)=join("-", ((split(/\s+/, scalar(localtime)))[0,1,2,4])); my($dest); my @logs =qw(Security System Application); foreach my $eventLog (@logs) { my $handle=Win32::EventLog->new($eventLog, $myServer) || die " +Can't open Application EventLog on $myServer $!"; $dest="C:\\Perl\\scripts\\$eventLog\\$date.evt"; $handle->Backup($dest) || die "Could not backup and clear the +$eventLog EventLog on $myServer ($^E)\n"; $handle->Close; } }