procmail
[Top] [All Lists]

Re: Controlling the procmail logfile ?

1997-08-22 12:15:55

Is there a way I can trim the procmail LOGFILE automatically so that it
stays at a certain size or keeps only information pertaining to the latest
N messages, or any other way of having procmail automatically trim this
file?

I create a separate logfile for each incoming message.

Umm.. how?

In .procmailrc near the beginning:

LOGFILE=$MAILDIR/Logs/`date '+%y%m%d_%H%M%S'`_$$   # one log per message

Makes the name of the logfile something like 970822_111642_5432.

The only way this can be non-unique is if two mails are received at
EXACTLY the same time on two different machines AND the two machines just
happen to select the same process IDs for procmail.  If there was a
duplicate, I believe one procmail would wait until the other was finished
and then use the same file.

Then I use a variation of the "delete old backups" (see 'man procmailrc')
to delete the older log files.

Neither my procmailex nor procmailrc manpages have any reference to above.

# Discard older log files
:0 ic
| cd Logs && rm -f dummy `ls -t 9* | sed -e 1,150d`

I guess you guys are talking about 3.11pre7?

I do have pre7 but for this, any version should be fine (since sed/cd/rm
are doing all the work).

<Prev in Thread] Current Thread [Next in Thread>