procmail
[Top] [All Lists]

Re: logging actions of recipes

2001-08-21 17:06:37
On 21 Aug, Pollywog wrote:
| I want to be able to log which recipes were responsible for certain
| actions, so after looking at the tips at 
| 
| http://www.uwasa.fi/~ts/info/proctips.html#which 
| 
| I put this in a procmail filter file:
| 
| 
| # Assume loud headers are spam
| :0
| * ^Subject: [A-Z0-9\?!._]*$
| {
|  :0
|  { RULE="cleanup.rc loud headers" }
|  INCLUDERC=$PMDIR/purge.rc
| }
| 
| 
| The problem is that although the log shows the usual entries for mail
| that is sent to /dev/null, there is no "RULE" entry in the log.  What am
| I doing wrong?
| 
| btw, purge.rc has this:
| 
| :0 hc:${HOME}/.procmail/headers.log.lock
|| cat >> ${HOME}/.procmail/headers.log
| {
|    :0
|    $TRASH
| }
| 
| 

LOG="$RULE
"
somewhere in one of the rcfiles responsible, probably in purge.rc, is
the "usual" way. Note, the closing quote is on the next line because
newlines are not automatically written to the log file with LOG=. Some
people defined a variable
NL="
"
for this purpose so you can write LOG="$RULE$NL" which might be more
pleasing to the eye. You could also use TRAP="echo $RULE" to get a log
write. This is all in the man pages, probably covered ad nauseum in the
list archive and various faqs and tutorials.

BTW, the recipe as posted won't do what you want because procmail
conditions are case insensitive by default. If the omission wasn't
simply a typo, you need a "D" flag on the recipe.

-- 
                   /"\
Don Hammond        \ /     ASCII Ribbon Campaign
Raleigh, NC US      X        Against HTML Mail,
                   / \      and News Too

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