dannyd has asked for the wisdom of the Perl Monks concerning the following question:
Greetings Old wise ones,
I am trying to write a script to save a copy of a particular EventLog(Application, System or Security) and if the save subroutine is called again and a saved file exists, then it should add the new events to the existing log.
I am a beginner and am having a real tough time with the documentation trying to figure out how to write a new event to the saved log, in the way it was written by the initial backup method call.
Please Help!!
This is what I have for save,
sub Save { our $DirName = 'WinLog'; &DirCreator($DirName); foreach (@arr) { my $Log_obj = Win32::EventLog->new("$_",""); $FileName = "$_\.evtx"; $Log_obj->Backup("\.\\".$DirName."\\"."$FileName"); switch ($^E) { case /^$/ { print "Log Successfully saved.";} case /^Cannot\ create\ a\ file\ when\ that\ file\ already\ + exists$/ ( <This is where Im stuck!!!> ) else { print "Error : $^E"}; } close ("$Log_obj"); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Win32::EventLog->Backup(), appending contents of new log to a saved one.
by Anonymous Monk on Jan 11, 2011 at 17:38 UTC | |
by Anonymous Monk on Jan 11, 2011 at 17:53 UTC | |
|
Re: Win32::EventLog->Backup(), appending contents of new log to a saved one.
by Gulliver (Monk) on Jan 11, 2011 at 17:06 UTC | |
by dannyd (Sexton) on Jan 12, 2011 at 07:15 UTC | |
by Anonymous Monk on Jan 12, 2011 at 14:30 UTC |