#!/usr/bin/perl

open LOG, $ENV{'LOGCAT'} ;
open REPORT, ">$ENV{'LOGREPORT'}" ;
open FILTER, ">$ENV{'LOGFILTER'}" ;

my %report ;
while ( <LOG> ) {
	chomp ;
	if ( m/IPVS: (.+) error/ ) {
		print FILTER ;
		print FILTER "\n" ;
		$report{$1}++ ;
		next ;
	}
}
close LOG ;
close FILTER ; 

if ( %report ) {
	print REPORT "<table width='100%' rules='cols' cellpadding='2'>\n" ;
	my $c = 0 ;
	foreach $k ( keys %report ) {
		print REPORT "<tr" . ( $c%2 == 0 ? " bgcolor='#dddddd'" : "" ) .">" ;
		print REPORT "<td>$k  (" . $report{$k} . ")</td></tr>\n" ;
		$c++ ;
	}
	print REPORT "</table>\n" ;
}
close REPORT ;
