[exim] Help with MySQL user stats

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Mark Elkins
Date:  
À: exim-users
Sujet: [exim] Help with MySQL user stats
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..



-- 
  .  .     ___. .__      Posix Systems - Sth Africa.  e.164 VOIP ready
 /| /|       / /__       mje@???  -  Mark J Elkins, Cisco CCIE
/ |/ |ARK \_/ /__ LKINS  Tel: +27 12 807 0590  Cell: +27 82 601 0496