Another logging question

2001-05-15 Thread Dean Staff

Hi, 

I've managed to get qmail to log the pop connections using a poplog  
script that contail s the following... 

#! /bin/sh 
echo "$TCPREMOTEIP" "$USER" | /var/qmail/bin/splogger pop3d 19  
pop="$1"; shift; exec "$pop" "$@" 

and edited the server_arg line in xined.conf to read 

server_arg  = localhost /bin/checkpassword /var/qmail/bin/poplog  
/var/qmail/bin/qmail-pop3d Maildir 

I get a log entry in /var/log/popper.log that looks like this... 

Apr 30 15:27:52 testmail pop3d: 988658872.496325 dean   
Apr 30 15:27:53 testmail pop3d: 988658873.529210 dean   

I need to be able to log the STAT output also. (how many unread  
message are in the user mailbox, and total size of all that users new 
 mail files) I have been unsuccessful in trying to get this info 
added  to the log. I'd to get it on the same line as as the userid if 
 possible. Would you have any suggestions. 

Thanks 
Dean 
  

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




Another logging question (second Post)

2001-05-16 Thread Dean Staff

Hi, 

I apologize for any double posting. I originally submitted this 
message before I had completed subscribing to the list. So I'm not 
sure if it made it or not.

If it did, I'm sorry, and I'll just sit patiently while someone 
anwers me.  

begin original message

I've managed to get qmail to log the pop connections using a poplog  
script that contail s the following... 

#! /bin/sh echo "$TCPREMOTEIP" "$USER" | /var/qmail/bin/splogger 
pop3d 19  pop="$1"; shift; exec "$pop" "$@" 

and edited the server_arg line in xined.conf to read 

server_arg  = localhost /bin/checkpassword /var/qmail/bin/poplog  
/var/qmail/bin/qmail-pop3d Maildir 

I get a log entry in /var/log/popper.log that looks like this... 

Apr 30 15:27:52 testmail pop3d: 988658872.496325 dean   Apr 30 
15:27:53 testmail pop3d: 988658873.529210 dean   

I need to be able to log the STAT output also. (how many unread  
message are in the user mailbox, and total size of all that users new 
 mail files) I have been unsuccessful in trying to get this info 
added  to the log. I'd to get it on the same line as as the userid if 
 possible. Would you have any suggestions. 

Thanks Dean   



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




Re: Another logging question (second Post)

2001-05-16 Thread Charles Cazabon

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... 
[...]
> I need to be able to log the STAT output also. (how many unread  
> message are in the user mailbox, and total size of all that users new 
>  mail files) I have been unsuccessful in trying to get this info 
> added  to the log. I'd to get it on the same line as as the userid if 
>  possible. Would you have any suggestions. 

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.

Charles
-- 
---
Charles Cazabon<[EMAIL PROTECTED]>
GPL'ed software available at:  http://www.qcc.sk.ca/~charlesc/software/
Any opinions expressed are just that -- my opinions.
---



Re: Another logging question (second Post)

2001-05-17 Thread Dean Staff

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- ex 546 Fax 613-248-4553
e-mail: [EMAIL PROTECTED] Web: http://www.protus.com




Re: Another logging question (second Post)

2001-05-17 Thread Charles Cazabon

Dean Staff <[EMAIL PROTECTED]> wrote:
> 
> Thanks Charles,
> 
> Your suggestion worked.

You're welcome.

> newmail=`ls /home/"$USER"/Maildir/new/ | wc -l`
> newmailbytes=`du -sb /home/"$USER"/Maildir/new/ | cut -f 1`

Hmmm.  I actually meant to refer to $HOME in my example, not $USER.
But either works, providing all your homedirs are in fact under /home/ .

Charles
-- 
---
Charles Cazabon<[EMAIL PROTECTED]>
GPL'ed software available at:  http://www.qcc.sk.ca/~charlesc/software/
Any opinions expressed are just that -- my opinions.
---



Re: Another logging question (second Post)

2001-05-17 Thread Dean Staff

On 17 May 2001, at 10:48, Charles Cazabon wrote:
> Dean Staff <[EMAIL PROTECTED]> wrote:
> > 
> > Thanks Charles,
> > 
> > Your suggestion worked.
> 
> You're welcome.
> 
> > newmail=`ls /home/"$USER"/Maildir/new/ | wc -l`
> > newmailbytes=`du -sb /home/"$USER"/Maildir/new/ | cut -f 1`
> 
> Hmmm.  I actually meant to refer to $HOME in my example, not $USER.
> But either works, providing all your homedirs are in fact under /home/
> .
Thanks again!

I tried $HOME as below and that also works. You did bring up a 
good point though. In my case all  user homedirs are in the same 
path, but I have admin accounts in another path that would not 
have worked with the previous script. Using $HOME eliminates the 
hard coded path.  

newmail=`ls $HOME/Maildir/new/ | wc -l`
newmailbytes=`du -sb $HOME/Maildir/new/ | cut -f 1`

Cheers
Dean


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