Re: [exim] Help with MySQL user stats

Góra strony
Delete this message
Reply to this message
Autor: Terry
Data:  
Dla: exim-users
Temat: Re: [exim] Help with MySQL user stats
Mark Elkins wrote:
> Because I'm not aware of any simple way to do real-time logging of
> e-mail stats inside exim - I've put together a few hacks...
>
> For example - to 'log' the number and size of emails - in routers
> I have....
>
> mysql_user:
>   driver = accept
> # Update this users stats with ... $message_size
>   condition = \
>    ${if eq {} \
>    {${lookup mysql {update admin set emcnt=emcnt+1,emsiz=emsiz
> +${message_size} \
>     where user='${local_part}@${domain}' and status>1}}} \
>    {no}{yes}}
>   retry_use_local_part
>   transport = mysql_delivery

>
> However - it 'works' for any address - not just addresses actually in my
> database..
>
> emcnt: A count of the users e-mail they have recieved
> emsiz: a running total of all their e-mail size
> status: if > 1 - the user is paid up - etc.
>
> I guess this is because I'm doing an Update and not a Select?
> How do I fix this.
>
>
> ps - What exim could do with is a general purpose "condition" which can
> be used to run a MySQL request at any time.... call it "dbrequest" and
> allow it to be used in all sections..??? This would be ideal then for
> stats gathering..
>
>
>
>

Have you seen exilog
http://duncanthrax.net/exilog/exilog.txt

Terry