From: ram on
One of our clients sends contract notes to their customers and they
require to store all logs of deliveries/bounces by some law.

They have requirements like

* The log should contain the full date including year
* The log line should indicate full info -->
sender,rcpt,datetime,size,status

I have managed to add custom logs in postfix source in bounce.c and
sent.c. (Thanks to the neatly structured code it wasnt much of an
effort)


Only problem is when a message expires there is no log line that says
$queue-id: "$sender" to "$rcpt" status=expired


How can I log this ?


Thanks
Ram

From: Victor Duchovni on
On Sat, Feb 20, 2010 at 03:43:25PM +0530, ram wrote:

> One of our clients sends contract notes to their customers and they
> require to store all logs of deliveries/bounces by some law.
>
> They have requirements like
>
> * The log should contain the full date including year
> * The log line should indicate full info -->
> sender,rcpt,datetime,size,status
>
> I have managed to add custom logs in postfix source in bounce.c and
> sent.c. (Thanks to the neatly structured code it wasnt much of an
> effort)
>
>
> Only problem is when a message expires there is no log line that says
> $queue-id: "$sender" to "$rcpt" status=expired
>
> How can I log this ?

Collate the logs by message-id. What expired is the message, therefore,
all recipients not yet delivered are expired.

If the client uses a decently written bounce-bot, they can parse any
bounces and extract the undelivered recipients.

--
Viktor.

P.S. Morgan Stanley is looking for a New York City based, Senior Unix
system/email administrator to architect and sustain our perimeter email
environment. If you are interested, please drop me a note.

From: Wietse Venema on
Victor Duchovni:
> On Sat, Feb 20, 2010 at 03:43:25PM +0530, ram wrote:
>
> > One of our clients sends contract notes to their customers and they
> > require to store all logs of deliveries/bounces by some law.
> >
> > They have requirements like
> >
> > * The log should contain the full date including year
> > * The log line should indicate full info -->
> > sender,rcpt,datetime,size,status
> >
> > I have managed to add custom logs in postfix source in bounce.c and
> > sent.c. (Thanks to the neatly structured code it wasnt much of an
> > effort)
> >
> >
> > Only problem is when a message expires there is no log line that says
> > $queue-id: "$sender" to "$rcpt" status=expired
> >
> > How can I log this ?
>
> Collate the logs by message-id. What expired is the message, therefore,
> all recipients not yet delivered are expired.

The logs contain "status=deferred" for recipients that could not
be delivered. You are interested in the "status=deferred" records
logged after the last

postfix/qmgr[DDD]: HHHHHHH: from=<user(a)example.com>, size=12345 ...

> If the client uses a decently written bounce-bot, they can parse any
> bounces and extract the undelivered recipients.

Indeed, Postfix bounces are in RFC-standardized form.

Wietse

From: ram on

On Sat, 2010-02-20 at 14:30 -0500, Victor Duchovni wrote:
> On Sat, Feb 20, 2010 at 03:43:25PM +0530, ram wrote:
>
> > One of our clients sends contract notes to their customers and they
> > require to store all logs of deliveries/bounces by some law.
> >
> > They have requirements like
> >
> > * The log should contain the full date including year
> > * The log line should indicate full info -->
> > sender,rcpt,datetime,size,status
> >
> > I have managed to add custom logs in postfix source in bounce.c and
> > sent.c. (Thanks to the neatly structured code it wasnt much of an
> > effort)
> >
> >
> > Only problem is when a message expires there is no log line that says
> > $queue-id: "$sender" to "$rcpt" status=expired
> >
> > How can I log this ?
>
> Collate the logs by message-id. What expired is the message, therefore,
> all recipients not yet delivered are expired.
>
But when a message expires , the recipient not delivered is not logged
at all.( Except for in status=deferred lines much much before the
expiry )
Collating lines from different places in the logfile calls for some
parsing. The parser may in itself be very trivial but I have to educate
the client to read "collated" :-(

> If the client uses a decently written bounce-bot, they can parse any
> bounces and extract the undelivered recipients.
>

Perfect.
We are already doing bounce handling at the bounce box.
The real requirement here is just cosmetic: "We need logs of every
single mail with *exact* status for 7 years"

From: Wietse Venema on
ram:
>
> On Sat, 2010-02-20 at 14:30 -0500, Victor Duchovni wrote:
> > On Sat, Feb 20, 2010 at 03:43:25PM +0530, ram wrote:
> >
> > > One of our clients sends contract notes to their customers and they
> > > require to store all logs of deliveries/bounces by some law.
> > >
> > > They have requirements like
> > >
> > > * The log should contain the full date including year
> > > * The log line should indicate full info -->
> > > sender,rcpt,datetime,size,status
> > >
> > > I have managed to add custom logs in postfix source in bounce.c and
> > > sent.c. (Thanks to the neatly structured code it wasnt much of an
> > > effort)
> > >
> > >
> > > Only problem is when a message expires there is no log line that says
> > > $queue-id: "$sender" to "$rcpt" status=expired
> > >
> > > How can I log this ?
> >
> > Collate the logs by message-id. What expired is the message, therefore,
> > all recipients not yet delivered are expired.
> >
> But when a message expires , the recipient not delivered is not logged
> at all.( Except for in status=deferred lines much much before the
> expiry )
> Collating lines from different places in the logfile calls for some
> parsing. The parser may in itself be very trivial but I have to educate
> the client to read "collated" :-(
>
> > If the client uses a decently written bounce-bot, they can parse any
> > bounces and extract the undelivered recipients.
> >
>
> Perfect.
> We are already doing bounce handling at the bounce box.
> The real requirement here is just cosmetic: "We need logs of every
> single mail with *exact* status for 7 years"

Record "status=deferred" just like "status=bounced" or "status=sent",
and when a message expires, use the last "status=deferred" information.

Wietse