[Techtalk] procmail log rotation

nicole colby at wsu.edu
Tue Jul 1 16:44:57 EST 2003


At 12:31 on Jul 1, Emma Jane Hogbin shook the earth with:

> Does anyone have a simple log rotation script for procmail logs? I'd like
> to rotate the logs once a week and keep two weeks worth of logs (current +
> 1 week old + 2 weeks old). I've tried working on this before, but whenever
> I remove the log file by hand Procmail stops logging output to a file...

If you have this problem (programs losing their file handles when you
rotate logs) and you do choose to use logrotate to suit your log rotation
needs, try using the "copytruncate" keyword to work around it. It should
leave the file handle intact so that procmail is still able to log, but
your log will still get rotated.

If you wanted to script it, you could use cp to copy the original log
into a new log, and then echo -n ""; into the original log to empty it
out. This might be a problem on big log files though as you could lose
data between the cp and the echo depending on how all that stuff actually
works.

-nicole





More information about the Techtalk mailing list