Re: [Exim] LOGS

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Willie Viljoen
Fecha:  
A: Thomas Kinghorn, Exim-Users (E-mail)
Asunto: Re: [Exim] LOGS
On Monday 24 February 2003 8:47, someone, possibly Thomas Kinghorn, typed:
> Does anyone have an example of a cron for rotating the mainlog and reject
> log for exim.


Tom, this can be done easily with the exicyclog script, which should be
installed on your system. On FreeBSD, this is at /usr/local/sbin/exicyclog,
the location may vary for your system.

On my system, running exicyclog from cron would be trivial:

00 00 * * *    /usr/local/sbin/exicyclog


To find the location of exicyclog for your system, you may use:

    which exicyclog


If it has been installed in a directory in your system's path, if Exim has
been installed in a custom directory, exicyclog will be in the bin/
subdirectory you selected.

exicyclog has one shortcoming though, it merely moves files to have new
names like .01. If you want a real rollover, where old logs are compressed,
I would sugest you use newsyslog(8) instead. This is only available on BSD
though, but to do this with newsyslog(8) you would need these in
/etc/newsyslog.conf:

/var/log/exim/mainlog                   640  10    100  *     Z
/var/log/exim/paniclog                  640  10    100  *     Z
/var/log/exim/rejectlog                 640  10    100  *     Z


Customize these as you wish, information is in newsyslog.conf(5).

If you are running a non-BSD system, you will have to do some quick shell
scripting to get (similar) behaviour. Here is a "poor man's" rollover
script I hacked out in double quick time, this could be done in a much
better way:

#!/bin/sh
# /usr/local/sbin/rolloverexim

cyclog=`which exicyclog`
gzip=`which gzip`
logdir="/var/log/exim"
## Replace with location of your exicyclog if not in path

rollover=`date +%s`

$cyclog
$gzip -S $rollover.gz *.01

This will produce compressed logs with names like
mainlog.01.<timestamp>.gz

This is not perfect, but it's fast to implement and will work.

Make your script executable:
chmod +x /usr/local/bin/rolloverexim

To add this to cron:

00 00 * * *    /usr/local/sbin/rolloverexim


Will

--
Willie Viljoen
Freelance IT Consultant

214 Paul Kruger Avenue, Universitas
Bloemfontein
9321
South Africa

+27 51 522 15 60
+27 51 522 44 36 (after hours)
+27 82 404 03 27 (mobile)

will@???