Clunk Werclick a écrit : > Hello, > > I have been toying with the best way to produce a report of 'allowed' > messages that have made it all the way through my Postfix. I love the > Postfix logs, they give such detail on failures and refusals and parsing > this is quite straightforward. > > The entertainment commences when I try to figure out how to produce a > report of 'allowed' messages. This needs to contain just a few pieces of > key information; > > date/time from to subject client IP > > At first, I thought 'this will be easy' but upon closer examination this > is not as simple as it looks. Where Postfix is multi-process, the bits > of information are in different places and consolidating this has some > challenges. In particular matching up (by script) the interaction for a > transaction between; > > postfix/smtpd > postfix/cleanup > postfix/virtual > postfix/qmgr > > Perhaps there is an easy way to get the five metrics I would like in a > report? >
do you really want the Subject? - what would this be useful for? - there may be privacy issues - it may be encoded or it may contain "non printable" characters (yes, some mailers "forget" to encode...) if you don't need the subject, then smtpd restrictions with an action of WARN will give you what you want in a single line. if you insist on the Subject, you'll need to do some aggregation. start by using header_checks to log the Subject. then test by sending a message to 1 recipient, and then a message to 2 (or more) recipients. this will show you how it is easy to handle in the single recipient case, but not in the multi-recipient case. > I am starting to think I may need to plug something in to 'scan' the > headers of a message after Postfix is done with it or pipe the messages > through a script? > > To keep things lean and for learning, I am interested to achieve this > with a some Perl- so my interest is really in finding the 'key' to link > the information together from what is already produced - or - to work > out how to get messages to pipe through a script as 'virtual' delivers > them. Unless Virtual can give me all the information I need (logging > options????) > > Perhaps some of the very clever guru's here have some useful suggestion? > >