procmail
[Top] [All Lists]

Re: Include message-id in log

2001-10-29 11:10:25
Bart Schaefer <schaefer(_at_)zanshin(_dot_)com> writes:

On Sun, 28 Oct 2001, Harry Putnam wrote:
[...]

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).

Yeah, I see the technique now.... Those make flags even I can
find... he he...  Thanks

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.

It has another good effect from my angle too.  It keeps a very lot of
logging confined to a less usefull log that only contains log messages
from the backup recipe.  Means the more interesting log is less
cluttered when scanning it by eye. 

You coached me right through this.  I have it working like I wanted
now.  Thanks.

PS- The awk script works good.  I can snatch out an interesting log
entry with:

      procscn -r "REGEXP"
(-r for regular)
I'm working on a -z flag that will do the sme in compressed logs.

Makes it handy to see what a recipe is doing easily.  Only having to
look at 15 or twenty of the right lines.  And more or less instantly.

When I get it finished .. do you think it would be of interest to post
here?  I know `old hands' would not be impressed but maybe some newer
people would use it.


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