jeff061 has asked for the wisdom of the Perl Monks concerning the following question:
So i have a script that needs to parse out a comma delimited syslog file based on error messages i have in a seperate file. Now i have one last thing to do to get this thing over with. After a downtime i need to search for a corresponding uptime message and append the uptime date and time to the end of what the script parses out. Something to keep in mind, the uptime may come after the script goes through the syslog. right now each time the script runs(every 15 minutes) it parses out the data, sends the output to a server, and clears the syslog. So i am going to have to have a way to keep a entry in memory, or a seperate file, until the uptime message gets logged.
Examples and current script:
The syslog is formatted identical to the current output, it has no uptime information conatined on the same line.
Current output:
server name, date, time, error message, error type(waning, error, notice)
What i need:
server name, date, time, error message, error type(waning, error, notice), uptime date, uptime time
Current script:
$logdir= "d:/logs/"; $logfile= "sysmonitor.log"; $errlst= "errorlist.txt"; &FltErr; sub FltErr { open (FH, "< $errlst"); my @errors = <FH>; chdir($logdir); open (msg, $logfile ); open (FILEHANDLE,">NTDTM.txt"); while (<msg> ) { chop($_); foreach my $error (@errors) { chomp ($error); if ($_ =~ $error) { print FILEHANDLE "$_ \n"; print "$_ \n"; } } } close (FILEHANDLE); } &Mail; sub Mail { `blat NTDTM.txt -t user\@email.com -f user\@email.com -s "Windows DTM +logs"`;
Any help is GREATLY appreciated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: comma delimited, syslog parsing
by ptkdb (Monk) on Oct 13, 2003 at 14:29 UTC | |
|
Re: comma delimited, syslog parsing
by dragonchild (Archbishop) on Oct 13, 2003 at 14:06 UTC | |
by jeff061 (Initiate) on Oct 13, 2003 at 14:23 UTC | |
by dragonchild (Archbishop) on Oct 13, 2003 at 14:33 UTC | |
|
Re: comma delimited, syslog parsing
by ant9000 (Monk) on Oct 13, 2003 at 14:21 UTC | |
|
Re: comma delimited, syslog parsing
by jeff061 (Initiate) on Oct 13, 2003 at 14:56 UTC | |
by dragonchild (Archbishop) on Oct 13, 2003 at 15:16 UTC | |
by jeff061 (Initiate) on Oct 13, 2003 at 16:05 UTC | |
by dragonchild (Archbishop) on Oct 13, 2003 at 16:39 UTC | |
by jeff061 (Initiate) on Oct 13, 2003 at 18:20 UTC | |
|