procmail
[Top] [All Lists]

Re: Include message-id in log

2001-10-29 09:04:59
On Sun, 28 Oct 2001, Harry Putnam wrote:

I want those lines to examine what is happening with certain spam
catching recipes.  Adjusting regexp etc.  Thats what my awk script
will do.  Pluck those lines from the log so I can see at a glance what
has happened with a certain message.

I suggest you try something like this:

MESSAGE_ID=`formail -xMessage-Id:`
TRAP="echo 'END $MESSAGE_ID'"
LOG="BEGIN $MESSAGE_ID
"

Followed by the recipes that will deliver the message.  You should then be
able to pull out everything between the BEGIN and END lines in the log.  
In this case you do not want to use a "c" before a { } block (you want the
TRAP to execute once only).

I'm trying something like this:
Leave the backup recipe in its original form and aim logging somewhere else
before it, back on after.

LOGFILE="OLD_FILE" <== near top of .procmailrc

  [...]

LOGFILE="NEW_FILE"
 :0 c
  backup/.
LOGFILE="OLD_FILE"

Yes, that should be fine.  It should also produce exactly the same results
as doing

LOGFILE=OLD_FILE
 [...]
:0 c
{
 LOGFILE=NEW_FILE
 :0
 backup/.
}

except that your way will not cause procmail to fork.

You hit on what I mean when you say `date` will be first from any
message delivery.  But the backup recipe is a copy so it logs the date
differently. Or maybe not at all.

It's "not at all."  When you assign to LOG, that log entry is written 
immediately, and then never again.

_______________________________________________
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>