procmail
[Top] [All Lists]

Re: Cleaning Procmail Logfiles

1999-06-28 20:33:38
Shane Fisher asked,

| Is there an elegant way to clean up the logfiles after awhile?  Can you
| set a limit to the number off messages it logs before wiping itself clean?

I don't see why not.  I have TRAP add a line of underscores and a blank line
after each log entry, and when I cut the logfile every day (on two ISPs I
have cron access; on the other the first incoming message of the day triggers
the cleanup routine),

  grep -c _________

counts the entries for me.  You could have TRAP call a script that counts the
log entries after each message and then acts accordingly, but it's less
overhead to do it once a day from cron than to check with every message.

The one thing to be careful of is to finish writing that log entry before you
delete the old logfile; actually, the safest thing is probably to rename it
(any other procmail instantiation that has started logging to it will know
it by its inode number by now and will follow that to the new name, and any
procmail instantiation that hasn't looked for the logfile yet will start one
under the old name) and then delete it manually after you've had a chance to
look at it.

| My logfile is huge now (from testing my filter scheme) and I'm tired of
| scrolling down for 5 minutes every time I want to see the latest entry.

Don't you have a quick way to get to the bottom, or something like the tail
utility to display only the bottom?

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