procmailrc logging
am 28.04.2006 21:39:31 von Ken
I have looked around documentation but can't find what I'm looking
for. Is there a way to log my procmailrc's results, but only verbose
enough to show me exactly what recipe got matched? I can only seem to
get it to either just tell me what mail folder it was sent to, or to
show me the full list of test up until what got matched, which really
fills up my log file quickly.
Thanks.
-Ken
Re: procmailrc logging
am 28.04.2006 23:31:42 von Felix Tilley
On Fri, 28 Apr 2006 19:39:31 +0000, Ken wrote:
>
> I have looked around documentation but can't find what I'm looking
> for. Is there a way to log my procmailrc's results, but only verbose
> enough to show me exactly what recipe got matched? I can only seem to
> get it to either just tell me what mail folder it was sent to, or to
> show me the full list of test up until what got matched, which really
> fills up my log file quickly.
>
> Thanks.
>
>
> -Ken
type procmail -v
for the mailing list.
--
Felix Tilley
OICFLLD
Colonel Fanatic Legions
Senior LARTvocate
Fanatic Legions
1-800-555-LART
Re: procmailrc logging
am 29.04.2006 03:16:34 von Garen Erdoisa
Ken wrote:
> I have looked around documentation but can't find what I'm looking
> for. Is there a way to log my procmailrc's results, but only verbose
> enough to show me exactly what recipe got matched? I can only seem to
> get it to either just tell me what mail folder it was sent to, or to
> show me the full list of test up until what got matched, which really
> fills up my log file quickly.
If you use nested procmail recipe, you can log information as you please
based on whatever events you want.
Example:
# Define the location of the procmail log file to use.
LOGFILE=${HOME}/procmail.log
# Define a new line character for use in log entries.
NL="
"
SOMEVARIABLE='example'
:0
* ^ Some pattern
{
LOG="[$$]$_: Saving mail in somefolder${NL}"
LOG="[$$]$_: SOMEVARIABLE=${SOMEVARIABLE}${NL}"
:0
somefolder
}
--
Garen
Re: procmailrc logging
am 29.04.2006 05:12:33 von Ken
Garen Erdoisa wrote:
> Ken wrote:
> > I have looked around documentation but can't find what I'm looking
> > for. Is there a way to log my procmailrc's results, but only verbose
> > enough to show me exactly what recipe got matched? I can only seem to
> > get it to either just tell me what mail folder it was sent to, or to
> > show me the full list of test up until what got matched, which really
> > fills up my log file quickly.
> If you use nested procmail recipe, you can log information as you please
> based on whatever events you want.
> :0
> * ^ Some pattern
> {
> LOG="[$$]$_: Saving mail in somefolder${NL}"
> LOG="[$$]$_: SOMEVARIABLE=${SOMEVARIABLE}${NL}"
> :0
> somefolder
> }
Thanks, Garen. I was hoping there would be a global way for the whole
procmailrc to do this. Currently I have set:
VERBOSE=yes
LOGFILE=$HOME/procmail.log
LOGABSTRACT=all
Setting VERBOSE to yes shows me every recipe until one gets matched.
Setting VERBOSE to no just shows me the email info and where it got
filtered to. I like that, but all I want added to it is what recipe
got matched. Can none of these settings do that?
Thanks again.
-Ken
Re: procmailrc logging
am 29.04.2006 05:41:18 von Garen Erdoisa
Ken wrote:
> Garen Erdoisa wrote:
>> Ken wrote:
>[snip]
> Setting VERBOSE to yes shows me every recipe until one gets matched.
> Setting VERBOSE to no just shows me the email info and where it got
> filtered to. I like that, but all I want added to it is what recipe
> got matched. Can none of these settings do that?
>
No. unfortunately. Procmail is very old, and really not that smart. It
doesn't even have a language really in the sense that you would think of
a computer language.
If you want it to do something fancy, you have to code it to do so.
It can get rather challenging at times writing procmail recipes that are
legacy compatible. Ie: Run on old VAX mainframes as well as the newer OS's.
the VERBOSE=yes setting is about as close as you'll get. That setting is
intended for debugging procmail recipes only as it can generate huge log
files with an unnecessary level of detail for every day use.
I suppose if you don't care about that, you could run with debug mode
on, then use another script to edit the output of that into a separate
logfile.
Otherwise, you'll just have to use LOG= as I described in places where
you want the data logged.
--
Garen
Re: procmailrc logging
am 29.04.2006 06:58:08 von Ken
Garen Erdoisa wrote:
> Ken wrote:
> > Setting VERBOSE to no just shows me the email info and where it got
> > filtered to. I like that, but all I want added to it is what recipe
> > got matched. Can none of these settings do that?
> >
> No. unfortunately. Procmail is very old, and really not that smart. It
> doesn't even have a language really in the sense that you would think of
> a computer language.
Got it. That's cool. Not worth my time to really worry about it if I
know if can't do it out of the box. I can just leave VERBOSE set to
yes for when I need to watch recipes.
Thanks again for your help.
-Ken
Re: procmailrc logging
am 30.04.2006 17:02:32 von keeling
Ken :
> Garen Erdoisa wrote:
> > Ken wrote:
> > > I have looked around documentation but can't find what I'm looking
> > > for. Is there a way to log my procmailrc's results, but only verbose
> > > enough to show me exactly what recipe got matched? I can only seem to
>
> > If you use nested procmail recipe, you can log information as you please
> > based on whatever events you want.
> >
> > :0
> > * ^ Some pattern
> > {
> > LOG="[$$]$_: Saving mail in somefolder${NL}"
> > LOG="[$$]$_: SOMEVARIABLE=${SOMEVARIABLE}${NL}"
> > :0
> > somefolder
> > }
>
> Thanks, Garen. I was hoping there would be a global way for the whole
> procmailrc to do this. Currently I have set:
>
> VERBOSE=yes
> LOGFILE=$HOME/procmail.log
> LOGABSTRACT=all
>
> Setting VERBOSE to yes shows me every recipe until one gets matched.
> Setting VERBOSE to no just shows me the email info and where it got
> filtered to. I like that, but all I want added to it is what recipe
> got matched. Can none of these settings do that?
Use "VERBOSE = no", then in each recipe, set "LOG" to a tag for that
recipe:
:0
* ^X-BeenThere:.*procmail@lists\.RWTH\-Aachen\.DE
{
LOG="procmail - "
:0:
00.procmail
}
In the log file, this produces something like this for each message
handled:
Default - From root@heretic.spots.ab.ca Sun Apr 30 05:10:01 2006
Subject: fcheck.sh output
Folder: /home/keeling/Mail/00.mbox 8541
Message-Id:
.... where "Default - " is the tag I set for mail falling into
~/Mail/mbox by default.
--
Any technology distinguishable from magic is insufficiently advanced.
(*) http://www.spots.ab.ca/~keeling Linux Counter #80292
- - Spammers! http://www.spots.ab.ca/~keeling/emails.html
http://www.ietf.org/rfc/rfc1855.txt
Re: procmailrc logging
am 02.05.2006 05:30:13 von AK
Ken wrote:
> I have looked around documentation but can't find what I'm looking
> for. Is there a way to log my procmailrc's results, but only verbose
> enough to show me exactly what recipe got matched? I can only seem to
> get it to either just tell me what mail folder it was sent to, or to
> show me the full list of test up until what got matched, which really
> fills up my log file quickly.
>
> Thanks.
>
>
> -Ken
>
>
Ken,
You could within each recipe have an entry:
:0
* test something
{
LOG="Matched recipe #1
"
:0
do_something
}
This will add the entry into the log when the test condition is met.
It also depends on what information you are trying to see.
Using a \/ in the test condition will result in data on the right to be
assigned to a MATCH variable.
AK