[Logwatch-Devel] New qpopper script

Kenneth Porter shiva@well.com
05 Apr 2002 20:52:21 -0800


--=-9hCKwzMuuWK1QmZ6hikT
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

I'm attaching a new script for qpopper. I've been using this for quite
some time and kept forgetting to forward it. It filters out some more
noise messages.



--=-9hCKwzMuuWK1QmZ6hikT
Content-Disposition: attachment; filename=in.qpopper
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; name=in.qpopper; charset=ISO-8859-1

#!/usr/bin/perl -w
##########################################################################
# $Id: in.qpopper,v 1.5 2002/01/03 11:49:53 ken Exp $
##########################################################################
# $Log: in.qpopper,v $
# Revision 1.5  2002/01/03 11:49:53  ken
# Don't log error message about reverse DNS failure. IP is already logged.
#
# Revision 1.4  2001/03/22 07:36:22  ken
# Flush bogus LX beta message, known reverse IP failures.
#
# Revision 1.3  2000/07/02 02:03:14  ken
# Add new don't-cares due to daemons running more verbosely.
#
# Revision 1.2  2000/04/19 06:35:20  ken
# Fix newline placement a bit.
#
# Revision 1.1  2000/04/19 06:11:23  ken
# Initial revision
#
##########################################################################

########################################################
# This was written and is maintained by:
#    Kenneth Porter <shiva@well.com>
#
# Please send all comments, suggestions, bug reports,
#    etc, to shiva@well.com.
#
########################################################

$Detail =3D $ENV{'LOGWATCH_DETAIL_LEVEL'};

while (defined($ThisLine =3D <STDIN>)) {
    if ( $ThisLine =3D~ /xsender/ ) {=20
	# We don't care about these
    }
    elsif ( $ThisLine =3D~ /.drac.:/ ) {=20
	# We don't worry about these for now
    }
    elsif ( $ThisLine =3D~ /Stats:/ ) {=20
	# We don't worry about these for now
    }
    elsif ( $ThisLine =3D~ /Timing/ ) {=20
	# We don't worry about these for now
    }
    elsif ( $ThisLine =3D~ /Incorrect octet count/ ) {=20
	# Bogus message from LX betas prior to B20
    }
    elsif ( $ThisLine =3D~ /canonical name of client/ ) {=20
	# Redundant message, IP is already logged
    }
    elsif ( $ThisLine =3D~ s/^connect from ([^ ]+)$/$1/ ) {
	$Connections{$ThisLine}++;
    }
    elsif ( $ThisLine =3D~ s/^apop \"(.*)\".*/$1/ ) {
	$ApopConnections{$ThisLine}++;
    }
    else {
	# Report any unmatched entries...
	push @OtherList,$ThisLine;
    }
}

if (
    (@OtherList) or
    ( ((keys %Connections) or (keys %ApopConnections)) and ($Detail >=3D 10=
) )
    ) {

    print "\n\n --------------------- in.qpopper Begin --------------------=
---- \n";

    if ( (keys %Connections) and ($Detail >=3D 10) ) {
	print "\nPlaintext Connections:\n";
	foreach $ThisOne (keys %Connections) {
	    print "   " . $Connections{$ThisOne} . " from " . $ThisOne;
	}
    }

    if ( (keys %ApopConnections) and ($Detail >=3D 10) ) {
	print "\nAPOP Connections:\n";
	foreach $ThisOne (keys %ApopConnections) {
	    print "   " . $ApopConnections{$ThisOne} . " from " . $ThisOne;
	}
    }

    if ($#OtherList >=3D 0) {
	print "\n**Unmatched Entries**\n\n";
	print @OtherList;
    }

    print "\n ---------------------- in.qpopper End -----------------------=
-- \n";

}

exit(0);

--=-9hCKwzMuuWK1QmZ6hikT--