########################################################################## # $Id: afpd,v 1.7 2005/07/13 16:07:53 mike Exp $ ########################################################################## $Detail = $ENV{'LOGWATCH_DETAIL_LEVEL'} || 0; $IgnoreUnmatched = $ENV{'afpd_ignore_unmatched'} || 0; while (defined($ThisLine = <STDIN>)) { if ( ( $ThisLine =~ /^FTP session closed./ ) or ( $ThisLine =~ /^(ANONYMOUS )?FTP login as \'.*\' from [^ ]+ \[.*\] to .*/ ) or ( $ThisLine =~ /^FTP no transfer time out, disconnected\./ ) or ( $ThisLine =~ /^PAM\(.*\): Authentication failure/ ) or ( $ThisLine =~ /^data_sendfile/ ) or ( $ThisLine =~ /^FTP no transfer timeout, disconnected\./ ) or ( $ThisLine =~ /^FTP login timed out, disconnected\./ ) or ( $ThisLine =~ /done/ ) or ( $ThisLine =~ /server_child/ ) or ( $ThisLine =~ /session from/ ) or ( $ThisLine =~ /ASIP session/ ) or ( $ThisLine =~ /logout/ ) ) { # We don't care about these } elsif ( ($Login) = ( $ThisLine =~ /login ([^ ]+)/) ) { $UserLogin{$Login}++; } else { # Report any unmatched entries... push @OtherList,$ThisLine; } } if (keys %UserLogin) { print "\nUsers Logged In:\n"; foreach $Line (keys %UserLogin) { print " $Line : $UserLogin{$Line} Time(s)\n"; } } if (($#OtherList >= 0) and (not $IgnoreUnmatched)) { print "\n**Unmatched Entries**\n"; print @OtherList; } exit(0); # vi: shiftwidth=3 tabstop=3 syntax=perl et