[Dovecot] Track when user last checked mail

Del Stoliker dstoliker at alphagraphics.com
Tue Apr 26 02:07:13 EEST 2005


>> First off I've just got to say thanks.  We just upgraded from UW to
Dovecot
>> migrating from mbox to maildir.  Wow, what a difference!  Load average
used
>> to hang around 5.0 during business hours and could get up to 20+ on a bad
>> day.  Now we rarely break 1.0!
>>
>> I'm wondering if there's a way to keep track of the last time a user
>> checked their email and whether they checked it using POP or IMAP.  We're
>> trying to gather statistics on what protocols our users use and find
>> accounts that haven't been checked for a long time.  We used to be able
to
>> do some of this with the finger command and the user's mbox.  I found a
>> script called "mfinger" that works better with Maildir, but it's designed
>> for Courier.

>You don't say how you wish to access this information, but this works:
>
>egrep "(pop|imap)-login: Login:" /var/log/mail.log | grep USERNAME| tail -1
>
>Assuming you run it before you rotate your logs, or you could miss out.

>Another way is to modify Dovecot a little and have it record whatever
activity 
>details you want directly into a Database, ie: SQLite / MySQL. This should
be 
>simple to do for some inclined developer (if this is a commercial project).


Thanks for the suggestions.  I guess I could have articulated my question a
little better.

Ideally, I'd like to have the user's protocol and timestamp recorded when
they check mail into a database.  I'd rather not modify dovecot itself -
seems like that would be a project itself just to maintain.

The only idea I'm coming up with so far is to grep the logfile for each user
in the manner you suggest on cron job (late at night while the server is
bored), parse the results, and record them into a database. The downfall is
that it's not real time.

I can't help but wonder if I'm reinventing the wheel here. Is someone else
doing something like this?




More information about the dovecot mailing list