Fwd: logwatch 7.3.6 patch to summarize no. of pop3/imap logins per user

"Kirk Bauer" <[email protected]>
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
The patches keep coming!


---------- Forwarded message ----------
From: Gilles Detillieux <[email protected]>
Date: Tue, Feb 12, 2008 at 9:50 AM
Subject: logwatch 7.3.6 patch to summarize no. of pop3/imap logins per user
To: [email protected], [email protected]
Cc: Gilles Detillieux <[email protected]>


Another patch for logwatch 7.3.6 to squeeze a bit more info out of the
 logs.  This patch should be applied over top of my patch from last week.

 --- logwatch/scripts/services/dovecot.patched   2008-02-08
15:01:29.000000000 -0600
 +++ logwatch/scripts/services/dovecot   2008-02-12 10:34:51.000000000 -0600
 @@ -63,12 +63,14 @@ while (defined($ThisLine = <STDIN>)) {
      } elsif ( ($User, $Host) = ( $ThisLine =~ /^pop3-login: Login:
(.*?) \[(.*)\]/ ) ) {
       if ($Host !~ /$IgnoreHost/) {
          $Login{$User}{$Host}++;
 +         $LoginPOP3{$User}++;
          $ConnectionPOP3{$Host}++;
          $Connection{$Host}++;
       }
    } elsif ( ($User, $Host) = ( $ThisLine =~ /^imap-login: Login:
(.*?) \[(.*)\]/ ) ) {
       if ($Host !~ /$IgnoreHost/) {
          $Login{$User}{$Host}++;
 +         $LoginIMAP{$User}++;
          $ConnectionIMAP{$Host}++;
          $Connection{$Host}++;
       }
 @@ -77,12 +79,14 @@ while (defined($ThisLine = <STDIN>)) {
     } elsif ( ($User, $Host) = ( $ThisLine =~ /^dovecot: pop3-login:
Login: user=\<(.*?)\>.*rip=(.*)\, lip=/ ) ) {
       if ($Host !~ /$IgnoreHost/) {
          $Login{$User}{$Host}++;
 +         $LoginPOP3{$User}++;
          $ConnectionPOP3{$Host}++;
          $Connection{$Host}++;
       }
    } elsif ( ($User, $Host) = ( $ThisLine =~ /^dovecot: imap-login:
Login: user=\<(.*?)\>.*rip=(.*)\, lip=/) ) {
       if ($Host !~ /$IgnoreHost/) {
          $Login{$User}{$Host}++;
 +         $LoginIMAP{$User}++;
          $ConnectionIMAP{$Host}++;
          $Connection{$Host}++;
        }
 @@ -195,6 +199,19 @@ if ( ( $Detail >= 10 ) and (keys %Login)
    $LoginCount = 0;
    foreach my $User (sort keys %Login) {
       print "\n\n  User $User:";
 +      if ($LoginPOP3{$User} > 0 || $LoginIMAP{$User} > 0) {
 +         print "   (";
 +         if ($LoginPOP3{$User} > 0) {
 +            print "$LoginPOP3{$User} POP3";
 +         }
 +         if ($LoginPOP3{$User} > 0 && $LoginIMAP{$User} > 0) {
 +            print "/";
 +         }
 +         if ($LoginIMAP{$User} > 0) {
 +            print "$LoginIMAP{$User} IMAP";
 +         }
 +         print ")";
 +      }
       $UserCount = 0;
       $NumHosts = 0;
       foreach $Host (sort SortIP keys %{$Login{$User}}) {


 --
 Gilles R. Detillieux              E-mail: <[email protected]>
 Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/
 Dept. Physiology, U. of Manitoba  Winnipeg, MB  R3E 3J7  (Canada)




-- 
Kirk Bauer <[email protected]>
http://linux.kaybee.org | www.logwatch.org
Author, Automating UNIX & Linux Administration
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.