procmail
[Top] [All Lists]

Re: Logging to syslog? and/or with message ids?

2002-04-04 11:55:08
jennyw(_at_)colorfulexpressions(_dot_)com writes:

I'm trying to trouble shoot a problem I'm having with my mail server, and 
I'm having a hard time trying to figure out when procmail events happen in 
relationship with postfix and fetchmail.  Both postfix and fetchmail are 
set to log to syslog, which makes it easy to see the sequence of events.  
Is there a way to do this with procmail, too?

Also, I noticed that the procmail log doesn't include the originating 
message IDs. Is there a way to get it to do this?

That always seemd odd to me too.  Seem verbose mode should do that by
default since mesg-id is the most used identifier a  message has.
Maybe good reasons why that isn't the case.

The issue is that fetchmail is choking with an SIGPIPE thrown from an MDA 
or a stream socket error.  I'm having it go through postfix, which makes 
this error weird.  But the error happens right after postfix pipes the 
message to procmail, so I figured I'd try to find out what procmail did 
what this particular message.  Unfortunately, I can't find the message 
because there is no message id and because the log goes to a separate file 
in my user directory.

Davids advice as always is good.  Here is a suggestion that may ease
your work a little.

I use code in promcailrc that encludes the message ID at the end of
procmail processing, so the script I'm about to describe would need to
be rewritten some what if you followed Davids advice about including
it first (but not too much).

My procmailrc is also designed to insert a START at the beginning of
processing of any message.  The message id is at the end.

I wrote a shell/awk script that takes a message id as argument and finds
the section in the procmail.log where that message id is processed.

 So my awk code looks for the message id but remembers all the lines
in that section.  When it sees the id it prints the lines from START
to message-id.

It spits out the entire verbose section, but for just that one message.
So in an instant I can see what procmail did with any given message.
(Long as the log hasn't been rotated.. and I have code for that event
too that uses zcat to read the compressed rotated logs)

The way you could employ such a script is to look in your other logs
(maillog etc) for problem message message id, then feed it to the shell
script:

        procscn '<numberletter(_at_)part(_dot_)of(_dot_)message-id>'

And in an instant the section of procmail.log dealing with that
message id would appear on stdout.

My code is pretty amateurish but if you want some help with such a
script, contact me off list.  However others here may be more
proficient script writers.  In fact, are almost gauranteed to be.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail