Logging number of pop3's email retrieved during a connection - was (IMAP/POP traffic accounting)

Bron Gondwana brong at fastmail.fm
Sat Nov 22 06:42:09 EST 2008


On Fri, Nov 21, 2008 at 02:27:07PM -0500, Anthony Tibbs wrote:
> Hi Eddy,
> 
> I had worked on this briefly and, given a day or so, I could probably come 
> up with a working solution at least for byte/traffic accounting.  Logging 
> 'messages retrieved' for POP3 could make some sense, but it gets complicated 
> with clients using "TOP" to partially retrieve messages for inspection, and 
> in the IMAP world its all but meaningless (since that might involve copies 
> to folders, etc.).
> 
> For pure traffic accounting purposes, though, that isn't so hard, 
> particularly if you don't want it saved in a database anywhere, but merely 
> added as a log entry.

We have a patch at fastmail that does rate logging - but we have some
tricky requirements that it doesn't log meta traffic, just body
transfers, and only some of those.  It's a bit weird.

I suspect it would actually be _easier_ to just do byte counting in
prot_write depending on the filehandle.

Actually, why not just do traffic counting on all protstreams?  It's not
that hard.

The attached patch adds traffic counting to pop3 and imap connections,
it prints total bytes in and out at shutdown or reset.  I've also
refactored our "auditlog" patch on top of this so that the traffic data
gets logged along with the sessionid allowing it to be easily tied back
to a login (you can do it with PID from the log file if you want, but
we use the session_id so we can track it back to the proxy logs on the
frontends and there to the source IP and specific login used - because
we allow our users to set up multiple passwords for their account with
different restrictions on use)

Counting messages would be a separate patch to just pop3.

Bron ( hey, I was interested.  It took about an hour and compiled first
       try! )
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cyrus-traffic-count-2.3.13.diff
Type: text/x-diff
Size: 6417 bytes
Desc: not available
Url : http://lists.andrew.cmu.edu/pipermail/info-cyrus/attachments/20081122/216906a8/attachment.bin 


More information about the Info-cyrus mailing list