On 16 May 2001, at 12:59, Charles Cazabon wrote:
> Dean Staff <[EMAIL PROTECTED]> wrote:
> > 
> > I've managed to get qmail to log the pop connections using a poplog 
> > script that contail s the following... 
> [...]
> > [...] 
> 
> Either expand your little POP3-logging shim, or write an additional
> one that comes just before qmail-pop3d in your run script.  Since
> you're serving your mail out of Maildirs in the user's home
> directories, finding the number of messages and total bytes in new/old
> mail is trivial:
> 
> oldmessages=`ls $USER/Maildir/old/ | wc -l`
> newmessages=`ls $USER/Maildir/new/ | wc -l`
> newmailbytes=`du -sb $USER/Maildir/new/ | cut -f 1`
> 
> Then print this as you do your current logging information.
> 
Thanks Charles,

Your suggestion worked.

For anyone else who is interested, Here's the final results.

I modified my poplog script tp read as follows...

#! /bin/sh
newmail=`ls /home/"$USER"/Maildir/new/ | wc -l`
newmailbytes=`du -sb /home/"$USER"/Maildir/new/ | cut -f 1`
echo "$TCPREMOTEIP" "$USER" "$newmail" "$newmailbytes" | 
/var/qmail/bin/splogger pop3d 19 
pop="$1"; shift; exec "$pop" "$@"  

I'm running a distor based on RedHat 7 so the pop3d daemon is called 
from xinetd. So the /etc/xinetd.conf file has a pop3 section that 
reads as follows....

service pop-3
{
    socket_type = stream
    user                = root
    wait                = no
    server              = /var/qmail/bin/qmail-popup
    server_args = localhost /bin/checkpassword /var/qmail/bin/poplog 
/var/qmail/bin/qmail-pop3d Maildir
}

Next, I edit the /etc/syslog.conf so the line for local3 reads...

local3.*                                                                
/var/log/popper.log

And finally with all this I get a /var/log/popper.log that has the 
following...

May 17 11:54:01 testmail pop3d: 990114841.105074  dean       4 20480
May 17 12:01:42 testmail pop3d: 990115302.090064  dean      12 57344


I hope this helps someone else.

Again Thanks to Charles for his response. 
Regards
Dean

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dean Staff
Protus IP Solutions
210 - 2379 Holly Lane
Ottawa, ON K1V 7P2 Canada
613-733-0000 ex 546 Fax 613-248-4553
e-mail: [EMAIL PROTECTED] Web: http://www.protus.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reply via email to