in reply to comma delimited, syslog parsing

So long as you can absolutely guarantee that commas will NOT appear any of the fields, you can quickly parse the line from the log file into a list with 'split'. Define some constants at the top of your file to represent their positions:
sub SERVER_NAME() { 0 } sub DATE() { 1 } # ... sub ERROR_TYPE() { 4 } # etc. while( <msg> ) { chomp ; @elements = split /,/ ; if( $elements[ERROR_TYPE] eq 'ERROR' ) { # handle error next ; } }
As for matching up uptimes and downtimes, that's a little trickier. You need to maintain some state information between each invocation of the script or the script needs to be constantly watching this file. The 'Storable' module will let you store a hash structure in a file and then retrieve it. This psuedo code may give you some guidelines where to start. It does not account for such frustrations as the log file disapearing and being recreated between runs.
use strict ; use Storable ; use FileHandle ; my($hashRef, $log) ; # program startup # read previous data: if( !-e 'myFile' ) { # myFile not found, assume we're starting from the beginning $hashRef->{lastPosition} = 0 ; # start at the beg # add other values as needed } else { $hashRef = retrieve('myFile') ; } $log = new FileHandle('logfile') ; $log->seek($hashRef->{lastPosition}, 0) ; # go back to previous point +searched ############# ## Process ## ############# ## ## save where the end of the file currently is, so ## we don't have to scan the whole file again next time ## $hashRef->{lastPosition} = $log->tell() ; # get file offset ## ## Store new state data ## store $hashRef, 'myFile' ;