I use the WIn32::EventLog and I wonder how to delete all event logs elements
I have this code:
#!/usr/local/bin/perl -w
use Win32::EventLog;
use File::stat;
use File::Find;
use strict;
my ($Event, @timearray, $filename,
$day, $month, $directory, $logfile, $fileage);
my $retrycount = 0;
# Where do you want to put the backup files?
$directory = 'c:/Support/EventLogs/';
for ('Application', 'System', 'Security' ) {
$retrycount = $retrycount + 1;
if ($retrycount >= 30 ) {$retrycount = 0; next};
$Event = new Win32::EventLog ("$_", "");
@timearray=localtime(time);
$month = sprintf ('%.2d', $timearray[4] +1);
$day = sprintf ('%.2d', $timearray[3]);
$filename = $directory . ($timearray[5]+1900) . '_' .
$month . '_' . $day . '_' . $_ . '.evt';
print "$filename\n";
unless ($Event->Clear($filename)) {sleep 5; redo};
$retrycount = 0;
#`gzip -9 $filename`;
}
But it seems not to work what s wrong?
Thanks
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]