[NRAO]

Procmail Revisited

Configuration File for LogRotate

Copy, paste, and edit this example, and save it (in ASCII text format!) to a file in your Unix login area called .logrotate.conf (note the leading "dot"). Replace the red underlined parts with your username.

/users/pmurphy/Mail/VIRUS {
    rotate 30
    weekly
    compress      
    delaycompress 
    missingok
    postrotate
       /home/nraosoft/bin/spamsummary /users/pmurphy/Mail/VIRUS.1
    endscript
}
/users/pmurphy/Mail/SPAM {
    rotate 30
    daily
    compress      
    delaycompress 
    missingok
    postrotate
       /home/nraosoft/bin/spamsummary /users/pmurphy/Mail/SPAM.1
    endscript
}
/users/pmurphy/Mail/procmail.log {
    rotate 12
    monthly
    compress
    missingok
}

Explanation

There are three parts to this logrotate configuration file. Each one specifies how a certain file should be "rotated". Rotation means the file (e.g., SPAM) is copied to, say, SPAM.1 and a new empty SPAM file is created.

  1. On a weekly basis, the VIRUS folder will be moved to VIRUS.1, and if that exists, VIRUS.1 should be first moved to VIRUS.2 and so on up to VIRUS.30. The delaycompress combined with the compress keyword means that VIRUS.2 and older folders will be compressed with gzip, so they'll actually be VIRUS.2.gz; this can save a lot of space.

  2. On a daily basis (we usually get far more spam-tagged mail than disinfected virii), the same thing is done for the SPAM folder.

  3. The postrotate section of the SPAM and VIRUS rules will call a program called spamsummary (available at all four NRAO sites) that will mail you a summary of what's in the particular folder; this is convenient and avoids the need to actually visit the old folders before they disappear. If you don't want such reports, simply remove the three lines starting with postrotate and including endscript.

  4. The last section of the logrotate configuration file takes care of rotating your procmail log file. You'll generally never have to look in it unless you do a lot more with procmail by adding extra rules (and need to find out what happened if you had a typo!). This prevents the procmail log file from growing to absurd sizes.
 


Procmail Revisited
Pat Murphy