[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Analysis script for my log output



early morning
question is asked
perl falls from keyboard

#!/usr/bin/perl
#
# List changes to aroot routes
#
while (<>) {
     if (/^(\S+) SUCCESS (\d+) \d+\.\d+ (\S+)/) {
         $date = $1;
         $hopc = $2;
         $dest = $3;
         # $dest =~ s/^.*\///; # remove leading router
         if ($dest ne $prevdest && $dest ne "*") {
             print "$date: CHANGE to $dest\n";
             $prevdest = $dest;
             $prevhop = $hopc;
         } elsif ($prevhop != $hopc) {
             print "$date: HOPS $prevhop to $hopc\n";
             $prevhop = $hopc;
         }
     }
}
--
Harald Tveit Alvestrand, alvestrand@cisco.com
+47 41 44 29 94
Personal email: Harald@Alvestrand.no