Re: [exim] am I crazy - writing message details to a log fil…

Etusivu
Poista viesti
Vastaa
Lähettäjä: Philip Hazel
Päiväys:  
Vastaanottaja: Marcus Barczak
Kopio: exim-users
Aihe: Re: [exim] am I crazy - writing message details to a log file on successful routing
On Mon, 26 Jun 2006, Marcus Barczak wrote:

> What i'd like to do is basically write a selection of header
> information to a log file for every single message that is
> successfully routed through the server but i'm struggling to work out
> where and how to put this kinda functionality in. I've experimented
> with using a 'condition =' and using embedded perl string expansion
> to write my log file. However you can only have a single condition
> per router? Can anyone think of a better way to do this? Ultimately
> I want to just call an embedded perl function at the end of each
> router (ie. after message has been successfully routed?)


Here's a kludge. I assume your successful router is routing the address
to a transport. If so, you can use the fact that the "transport" option
is expanded. So you can use the expansion to call Perl, or a database,
or whatever, but ensure that the result is just the name of the
transport. (Best performance would probably be obtained by writing a
daemon that listens on a socket and have Exim write to the socket.)

Alternatively, why not do the archiving from a system filter? That runs
per-message rather than per-recipient (saving some resources), and
there's no problem writing to a file directly from the filter, using the
logwrite command. The downside, I guess, is that you don't know whether
the message will be successfully routed at filter time.

-- 
Philip Hazel            University of Cambridge Computing Service
Get the Exim 4 book:    http://www.uit.co.uk/exim-book