procmail
[Top] [All Lists]

Include message-id in log

2001-10-27 16:03:42
Procmail being 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/.
Writes a dup of all incoming in MH format to ~/spool/backup/.  I
suspect it is the `c' flag that causes the different behavior
concerning  recording the Message-ID:  Log output for this recipe
looks like the example below.  You'll notice the backup part never
assigns an EXITCODE=0 which seem likely to be related too.

If procmail never closes there then the TRAP doesn' execute maybe? 
This sample tried to include the tail of a previous entry and the
complete entry for the `backup' recipe, I've placed Asterisks at what
looks like it might be the end of one and the start of another.  But
as I mentioned its not really that easy to tell.

  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"
  procmail: Acquiring kernel-lock
  From seawolf-list-admin(_at_)redhat(_dot_)com  Thu Oct 25 13:05:06 2001
   Subject: 7.2 Network installation ...or  a hole in the  ground
    Folder: backup/22109                           3984
  procmail: No match on "dh(_at_)ptw\(_dot_)com"

I'd really like the log to uniformly list the Message-id in a set
place and wondered if that can be forced somehow on my backup recipe.
_______________________________________________
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>