in reply to Log Monitor
The best way to do this , in this case is similar to the following, in which you split each line, look for the unique ID, and push the rest into a hash of arrays.
Note that you can also collect statistics at this point, but because it sounds like to want to do this while the log is active, you ought to read through the log as fast as possible, then proccess after that step. Doing the stats while reading may be problematic.my %mailhash; while (<LOG>) { my( $date, $time, $message, @rest ) = split /\s+\; if ( $message ~= /^\w{6}\-\w{6}\-\w{2}$/ ) { $mailhash{ $message } ||= []; push @{ $mailhash{ $message } }, join(" ", @rest); } }
-----------------------------------------------------
Dr. Michael K. Neylon - mneylon-pm@masemware.com
||
"You've left the lens cap of your mind on again, Pinky" - The Brain
"I can see my house from here!"
It's not what you know, but knowing how to find it if you don't know that's important
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Log Monitor
by particle (Vicar) on Jan 05, 2002 at 19:56 UTC |