procmail
[Top] [All Lists]

Include message-id in log

2001-10-27 16:10:20
Procmail beigng the sturdy little tool that it is, has a certain
drawback in that you can put it to work and leave it alone for long
periods.  Long enough to forget whatever little bit you might have
known.

I've used the technique below, posted here long ago in answer to a
post of mine, to include the message id of messages handled by
procmail in the log.  I like this for handyness in matching events in
the log to mail samples like when refining a spam setup.

Top of .procmailrc:
   ## --*-shell-script-*--
   PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin
   SHELL=/bin/bash
   MAILDIR=$HOME/spool
   LOGABSTRACT=ALL
   ##INCLUDERC=procvars
   VERBOSE=YES
   LOGFILE=$HOME/t/var/log/procmail.log
   LOG=`date +"%b %d %T %w"`
   TRAP='formail -XMessage-Id:'

As I recall LOGABSTRACT=ALL and the TRAP='formail -XMessage-Id:', are
what give my logs the content I like:

[...]
procmail: No match on "^Received: (_dot_)*(_at_)hotmail\(_dot_)com"
procmail: Assigning "LASTFOLDER=prinb.in"
procmail: Opening "prinb.in"
procmail: Acquiring kernel-lock
procmail: Notified comsat: "reader(_at_)0:/home/reader/spool/prinb.in"
From root  Thu Oct 25 13:04:01 2001
 Subject: reader.local.lan 10/25/01:13.04 system check
  Folder: prinb.in                                                        15685
procmail: Assigning "EXITCODE=0"
procmail: Executing "formail,-XMessage-Id:"
Message-Id: <200110252004(_dot_)f9PK41q01322(_at_)reader(_dot_)local(_dot_)lan>
procmail: Executing "date,+%b %d %T %w"
procmail: Assigning "LOG=Oct 25 13:05:06 4"
Oct 25 13:05:06 4procmail: Assigning "TRAP=formail -XMessage-Id:"
procmail: [1431] Thu Oct 25 13:05:07 2001
procmail: Assigning "LASTFOLDER=backup/22109"
procmail: Opening "backup/22109"
[...]

Not totally sure where one stops and the next one starts but you'll
notice at the `  Folder: ' line  the next three lines always appear
and end with the Message-ID:

I've written some scripting that depends on that Message-ID being
where you see it.  Scripting that extracts certain info from the log.

Until I started writing this script I hadn't noticed that at least
certain recipe do not get this treatment.  So the log has hundreds
of entries where there is no Message-ID supplied.

The main culprit is a recipe that feeds  a simple backup system

 :0 c
 backup/.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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