#!/usr/local/bin/perl -w use strict; my $count=00; my $processed_log=$ARGV[0]; # Now that we have the logs, let's give a breakdown of BIND/UNBINDS # per hour. To start, I'll make it easy and just do them on an hourly # basis (eg. 09:00-09:59, 10:00-10:59, etc...) open PROCESSED_LOG, "<$processed_log" or die "Cannot open $processed_log: $!\n"; my @LOGFILE=; print"BINDS UNBINDS\n"; for ($count=00; $count<24; ++$count) { $count=sprintf("%02d",$count); my $bind=0; my $unbind=0; # I know I'm looping over and over this array. I have to # because the parsed log file does not begin or end on # hour 00:00:00. It actually starts at about 02:14:00. # Why they chose to roll the log file at 2:15 am, I'll # never know, but there you have it. foreach (@LOGFILE) { if ($_=~/$count:\d\d:\d\d/) { if ($_=~/UNBIND/) { ++$unbind; } elsif ($_=~/BIND/) { ++$bind; } } } my $total=$bind+$unbind; printf ("Hour $count has %5d BINDS and %5d UNBINDS TOTAL=%-6d\n",$bind,$unbind,$total); # print"BINDS UNBINDS\n"; # printf ("%-5d %5d\n",$bind,$unbind,$total); }