#!/usr/bin/perl -w
##########################################################################
# $Id: sshd2,v 1.1 2002/03/29 15:32:14 kirk Exp $
##########################################################################
# $Log: sshd2,v $
# Revision 1.1  2002/03/29 15:32:14  kirk
# Added some filters found in RH's release
#
# First Version 1.0  2000/17/04 00:53:43  gerald
#
##########################################################################

########################################################
# This was written and is maintained by:
#    Gerald Teschl <gerald@esi.ac.at>
#
# Please send all comments, suggestions, bug reports,
#    etc, to gerald@esi.ac.at and kirk@kaybee.org.
#
########################################################

$Detail = $ENV{'LOGWATCH_DETAIL_LEVEL'};

while (defined($ThisLine = <STDIN>)) {
    if ( ($ThisLine =~ /^Daemon is running.$/) or
	($ThisLine =~ /^Listener created on port .*$/) or
	($ThisLine =~ /^sshd2$/) ) {
	# don't care about these
    }
    elsif ( $ThisLine =~ /^Starting sshd2: $/ ) {
	$Started++;
    }
    else {
	# Report any unmatched entries...
	chomp($ThisLine);
	$OtherList{$ThisLine}++;
    }
}

if ( ($#OtherList >= 0) or (($Detail >= 10) and ($Started)) ) {

    print "\n\n --------------------- Sshd2 Begin ------------------------ \n";

    if ( ($Detail >= 10) and ($Started) ) {
	print "\nStatistics:\n";
	print "   Sshd2 started: $Started Time(s)\n";
    }

    if (keys %OtherList) {     print "\n**Unmatched Entries**\n";
	foreach $ThisOne (keys %OtherList) {
     	  print "$ThisOne: $OtherList{$ThisOne} Time(s)\n";
     	}
    }                                                                               	
    print "\n\n ---------------------- Sshd2 End ------------------------- \n\n";

}
    
exit(0);



