Re: [exim] Message logging with SQL

Top Page
Delete this message
Reply to this message
Author: Karl Fischer
Date:  
To: exim-users
Subject: Re: [exim] Message logging with SQL
Am 06.05.2010 10:20, schrieb Ron White:
> Good morning,
>
> I'm looking at the concept of creating a message log database which
> contains one line for each message that my Exim sees.
>
> At this point I'm mostly guessing, but I suspect in the my various ACL
> 'drop' or 'deny' statements I could probably add something like:
>
> set acl_m_nullthing = ${lookup mysql{INSERT INTO
> maillog(recipient,sender,client_ip) VALUES ('${quote_mysql:$local_part}@
> ${quote_mysql:$domain}','foo','bar');}}
>
> But I don't know how I would approach the problem of successful messages
> that are not dropped, ie, have passed through a transport successfully.
> Probably hoping to much, but I'd love to be able to log the message ID
> and, where appropriate, the physical file name and location of the
> delivered message in addition to the ip, to, from, subject.
>
> I can probably hash up some kind of Perl script to trawl the logs at a
> preset interval and populate a database, but it would be much 'nicer' if
> I could do it as the message rolls through Exim.
>
> Anyone know if it's possible to do this? Forgive me if the question is
> stupid - but I'm not the sharpest knife in the drawer ;-)


Hi Ron,

I've been there (and haven't completely solved it myself yet) - but since
exim doesn't support jmp/goto and/or loops it's kinda difficult to catch
each and every deny/defer/drop/accept and so on - you already saw that ...

How about a different approach? Have you looked at syslog-ng?
Having exim write to syslog and having syslog-ng write to SQL DB might
be it ...

see: http://www.balabit.com/network-security/syslog-ng/
(there's an open-source version)

hth

- Karl