procmail
[Top] [All Lists]

Re: Reducing the log file

1997-06-07 11:47:00
On Fri, 6 Jun 1997, Chris Fieldhouse wrote:

Currently my Procmail logs *all* my e-mail,
whether the e-mail was let through to the mail spool or 
sent of to oblivion.

I have to deal with 100+ emails per day
(about 3-5 will be spam)
Is there anyway to tell procmail only to log those
e-mails it filtered out for me?

    You might be able to adapt a technique I use (perfected with the
assistance of the kind folks on this list).  In normal operation I run
with procmail logging off.  However, I do discard incoming mail such as
spam (as well as I can identify it reliably).  I do this via an 
{ INCLUDERC=$PMDIR/bitbucket.rc } as the action routine, which makes a
one-line entry in the log.  It looks like this:

##################################################
#  Normally called in with something like        #
#    { INCLUDERC=$PMDIR/bitbucket.rc }           #
#  as the action routine for a recipe.           #
#    This recipe makes a special one-line        #
#    entry in the procmail log and then          #
#    discards the item of mail.                  #
##################################################

# Turn on logging so we can record the action
VERBOSE=off
LOGABSTRACT=yes

:0  # When was it mailed?
* ^Date: *\/[^ ].*
{ THEDATE=$MATCH }

:0  # From whom did it come?
* ^From: *\/[^ ].*
{ WHOFROM=$MATCH }

:0  # What is the subject?
* ^Subject: *\/[^ ].*
{ THESUBJ=$MATCH }

# Get message size (recipe from David W. Tamkin)
:0HB   # Note trailing period in first condition line
* 1^1 .
* 1^1 ^.*$
* -1^0
{ }
THESIZE = $=

# Log disposition; splitting "" across lines is deliberate
LOG="Discarded file: $THEDATE $WHOFROM $THESUBJ $THESIZE
"

# Reset logging to what it normally is for our procmail
VERBOSE=$VERBOSITY
LOGABSTRACT=$LOGGING

:0                         # Trash this piece
/dev/null

Maybe you can adapt this into something that suits your situation.

Paul                             <pobart(_at_)access(_dot_)digex(_dot_)net>
----------------------------------------------------------
Paul O. Bartlett, P.O. Box 857, Vienna, VA 22183-0857, USA
Finger, keyserver, or WWW for PGP 2.6.2 public key
Home Page:  http://www.access.digex.net/~pobart

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