Changing postfix' logging behaviour

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Changing postfix' logging behaviour

Leon Weber-2
Hello,

I'm wondering if there's a way to change postfix' logging behaviour. In
particular, I'd like to have a line in the log containing the To, From, and
Subject headers when receiving mail. Any ideas how I'd realize that?

Leon

--
Leon Weber, [hidden email] 0x8E04D7FC
blog: https://leonweber.de/blog
jabber: [hidden email] (icq: 261067046)
--
Ein dreieckiges Rad ist gegenueber dem viereckigen Rad ein Fortschritt,
da es pro Umdrehung einen Hopser weniger gibt.

attachment0 (204 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Changing postfix' logging behaviour

Victor Duchovni
On Sat, May 17, 2008 at 06:53:31PM +0200, Leon Weber wrote:

> Hello,
>
> I'm wondering if there's a way to change postfix' logging behaviour. In
> particular, I'd like to have a line in the log containing the To, From, and
> Subject headers when receiving mail. Any ideas how I'd realize that?

Syslog entry size limits are too low for this purpose. You can at best
get a fragment of these (when they are large). You are likely solving
the wrong problem. Describe the real problem.

--
        Viktor.

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the "Reply-To" header.

To unsubscribe from the postfix-users list, visit
http://www.postfix.org/lists.html or click the link below:
<mailto:[hidden email]?body=unsubscribe%20postfix-users>

If my response solves your problem, the best way to thank me is to not
send an "it worked, thanks" follow-up. If you must respond, please put
"It worked, thanks" in the "Subject" so I can delete these quickly.
Reply | Threaded
Open this post in threaded view
|

Re: Changing postfix' logging behaviour

Leon Weber-2
On 17.05.2008 13:39:42, Victor Duchovni wrote:

> On Sat, May 17, 2008 at 06:53:31PM +0200, Leon Weber wrote:
>
> > Hello,
> >
> > I'm wondering if there's a way to change postfix' logging behaviour. In
> > particular, I'd like to have a line in the log containing the To, From, and
> > Subject headers when receiving mail. Any ideas how I'd realize that?
>
> Syslog entry size limits are too low for this purpose. You can at best
> get a fragment of these (when they are large). You are likely solving
> the wrong problem. Describe the real problem.
I've set up some syslog monitoring via jabber, and as a side-effect I get these
lines:
May 17 19:40:30 postfix/local 6CD268CDABD: to=<[hidden email]>, relay=local,
delay=6, delays=0.2/0/0/5.8, dsn=2.0.0, status=sent (delivered to command:
/usr/bin/procmail)
-> so I can see when I get mail on my desktop. I'm using mutt, so I lived
without such a ping before, but it is quite nice ;)

Now I thought if I could add these headers somewhere in the log, the jabber
notification would be more useful.

Leon

--
Leon Weber, [hidden email] 0x8E04D7FC
blog: https://leonweber.de/blog
jabber: [hidden email] (icq: 261067046)
--
Anyway, you should learn German. It's no more difficult than regex. (Richard Quinn)

attachment0 (204 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Changing postfix' logging behaviour

Victor Duchovni
On Sat, May 17, 2008 at 07:46:54PM +0200, Leon Weber wrote:

> delay=6, delays=0.2/0/0/5.8, dsn=2.0.0, status=sent (delivered to command:
> /usr/bin/procmail)
> -> so I can see when I get mail on my desktop. I'm using mutt, so I lived
> without such a ping before, but it is quite nice ;)
>
> Now I thought if I could add these headers somewhere in the log, the jabber
> notification would be more useful.

Doesn't mutt notice new mail reasonably soon after it arrives?

If you really want the full messag context, you can bcc your mail to a
pipe(8) transport that sends the IMs (and ideally rate limits if messages
arrive too fast). You can use ".forward" if you mailbox is local. In either
case the command that sends the jabber notices must never return a failure
code, missed IMs should not prevent mail delivery.

If you want a partial subject, use "WARN" in header_checks (but not
nested_header_checks which requires an explicit setting to not follow
header_checks). I would not bother with To/Cc.

--
        Viktor.

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the "Reply-To" header.

To unsubscribe from the postfix-users list, visit
http://www.postfix.org/lists.html or click the link below:
<mailto:[hidden email]?body=unsubscribe%20postfix-users>

If my response solves your problem, the best way to thank me is to not
send an "it worked, thanks" follow-up. If you must respond, please put
"It worked, thanks" in the "Subject" so I can delete these quickly.
Reply | Threaded
Open this post in threaded view
|

Re: Changing postfix' logging behaviour

Leon Weber-2
On 17.05.2008 14:05:22, Victor Duchovni wrote:
> Doesn't mutt notice new mail reasonably soon after it arrives?

Yes it does, but it doesn't notify me, I have to look into the mutt shell every once
in a while. That's not a real problem, but I'd like a notification better.

> If you really want the full messag context, you can bcc your mail to a
> pipe(8) transport that sends the IMs (and ideally rate limits if messages
> arrive too fast). You can use ".forward" if you mailbox is local. In either
> case the command that sends the jabber notices must never return a failure
> code, missed IMs should not prevent mail delivery.

This sounds sane. I'll consider that, thanks.

Leon

--
Leon Weber, [hidden email] 0x8E04D7FC
blog: https://leonweber.de/blog
jabber: [hidden email] (icq: 261067046)
--
Es nützt der Freiheit nichts, dass wir sie abschaffen, um sie
zu schützen. (Wolfgang Thierse)

attachment0 (204 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Changing postfix' logging behaviour

Gerry Massat
In reply to this post by Victor Duchovni
Victor Duchovni wrote:

> On Sat, May 17, 2008 at 07:46:54PM +0200, Leon Weber wrote:
>
>  
>> delay=6, delays=0.2/0/0/5.8, dsn=2.0.0, status=sent (delivered to command:
>> /usr/bin/procmail)
>> -> so I can see when I get mail on my desktop. I'm using mutt, so I lived
>> without such a ping before, but it is quite nice ;)
>>
>> Now I thought if I could add these headers somewhere in the log, the jabber
>> notification would be more useful.
>>    
>
> Doesn't mutt notice new mail reasonably soon after it arrives?
>
> If you really want the full messag context, you can bcc your mail to a
> pipe(8) transport that sends the IMs (and ideally rate limits if messages
> arrive too fast). You can use ".forward" if you mailbox is local. In either
> case the command that sends the jabber notices must never return a failure
> code, missed IMs should not prevent mail delivery.
>
> If you want a partial subject, use "WARN" in header_checks (but not
> nested_header_checks which requires an explicit setting to not follow
> header_checks). I would not bother with To/Cc.
>  
Well, you do get a From/To with "/^Subject:/     WARN" in header_checks-
but that's the envelope info.  For me it's good enough!

May 17 13:06:00 plankton postfix/cleanup[18648]: E6A8B6555: warning:
header Subject: Re: Changing postfix' logging behaviour from
russian-caravan.cloud9.net[168.100.1.4]:unknown;
from=<[hidden email]> to=<[hidden email]> proto=ESMTP
helo=<russian-caravan.cloud9.net>

Reply | Threaded
Open this post in threaded view
|

Re: Changing postfix' logging behaviour

Arturo 'Buanzo' Busleiman
In reply to this post by Leon Weber-2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Leon Weber wrote:
| Yes it does, but it doesn't notify me, I have to look into the mutt shell every once
| in a while. That's not a real problem, but I'd like a notification better.

The simplest thing might be to use maildrop, and create a .mailfilter file for your account:

logfile $HOME/.maildroplog

Then, you could have a simple perl/python/whatever script to continuously read that file, parse each
new block (includes subject), and use sendxmpp utility to IM you.

- --
Arturo "Buanzo" Busleiman
Reliable inter-continental Mail Relay Service - Ask me!
Independent Security Consultant - SANS - OISSG
http://www.buanzo.com.ar/pro/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFILyN2AlpOsGhXcE0RClUWAJ9t3D46fzMQ15+hqnG+UCpeIOUraQCeNnl5
cf/dsBEeU33oD6Xfbq3AIC0=
=OIU2
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

Re: Changing postfix' logging behaviour

/dev/rob0
On Sat May 17 2008 13:27:02 Arturo 'Buanzo' Busleiman wrote:
> Leon Weber wrote:
> | Yes it does, but it doesn't notify me, I have to look into the mutt
> | shell every once in a while. That's not a real problem, but I'd
> | like a notification better.
>
> The simplest thing might be to use maildrop, and create a .mailfilter
> file for your account:

He's already using procmail. It wouldn't be difficult to cook up a
recipe to do what he's asking.
--
    Offlist mail to this address is discarded unless
    "/dev/rob0" or "not-spam" is in Subject: header
Reply | Threaded
Open this post in threaded view
|

Re: Changing postfix' logging behaviour

Arturo 'Buanzo' Busleiman
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

/dev/rob0 wrote:
| He's already using procmail. It wouldn't be difficult to cook up a
| recipe to do what he's asking.

"Tracking Your Incoming Messages" (procmail)
http://www.ii.com/internet/robots/procmail/qs/#tail-f

- --
Arturo "Buanzo" Busleiman
Reliable inter-continental Mail Relay Service - Ask me!
Independent Security Consultant - SANS - OISSG
http://www.buanzo.com.ar/pro/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIL0ecAlpOsGhXcE0RCr4EAJ42izeVyL6PazcocnB5nJbTNM7RSwCdHUVR
+gMxLTAaDY2qCbQz+J6AJX8=
=y5bW
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

Re: Changing postfix' logging behaviour

Wietse Venema
In reply to this post by Leon Weber-2
Leon Weber:
> Hello,
>
> I'm wondering if there's a way to change postfix' logging behaviour. In
> particular, I'd like to have a line in the log containing the To, From, and
> Subject headers when receiving mail. Any ideas how I'd realize that?

Use the BIFF service.
man 5 postconf | less +/biff

        Wietse