On 2/9/2012 8:29 AM, Robert Schetterer wrote: > Hi , is there a simple way to do logging > of all used helo s, beside debug mode ?
Here's a little patch that adds helo= to the client info log entry. This has been posted to this list before. It should apply to all "recent" versions of postfix. The modified log entry retains compatibility with pflogsumm.pl and postfix-logwatch. Standard log line: Feb 9 08:46:21 mgate3 postfix/smtpd[44656]: NOQUEUE: client=exprod8ob105.obsmtp.com[64.18.3.89] patched log line: Feb 9 08:46:21 mgate3 postfix/smtpd[44656]: NOQUEUE: client=exprod8ob105.obsmtp.com[64.18.3.89], helo=exprod8ob105.obsmtp.com --- /usr/local/src/postfix-2.8-20100728/src/smtpd/smtpd.c Mon Jul 26 18:39:39 2010 +++ src/smtpd/smtpd.c Tue Aug 10 16:42:36 2010 @@ -1916,13 +1916,16 @@ #define PRINT2_OR_NULL(cond, name, value) \ PRINT_OR_NULL((cond), (name)), PRINT_OR_NULL((cond), (value)) - msg_info("%s: client=%s%s%s%s%s", + msg_info("%s: client=%s%s%s%s%s%s%s%s%s", (state->queue_id ? state->queue_id : "NOQUEUE"), state->namaddr, PRINT2_OR_NULL(HAVE_FORWARDED_IDENT(state), ", orig_queue_id=", FORWARD_IDENT(state)), PRINT2_OR_NULL(HAVE_FORWARDED_CLIENT_ATTR(state), - ", orig_client=", FORWARD_NAMADDR(state))); + ", orig_client=", FORWARD_NAMADDR(state)), + ", helo=", state->helo_name ? state->helo_name : "", + PRINT2_OR_NULL(HAVE_FORWARDED_CLIENT_ATTR(state), + ", orig_helo=", FORWARD_HELO(state) ? FORWARD_HELO(state) : "")); return (0); } --- /usr/local/src/postfix-2.8-20100728/src/smtpd/smtpd_sasl_proto.c Mon Jul 26 18:40:14 2010 +++ src/smtpd/smtpd_sasl_proto.c Tue Aug 10 17:56:42 2010 @@ -243,7 +243,7 @@ #define PRINT2_OR_NULL(cond, name, value) \ PRINT_OR_NULL((cond), (name)), PRINT_OR_NULL((cond), (value)) - msg_info("%s: client=%s%s%s%s%s%s%s%s%s%s%s", + msg_info("%s: client=%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s", (state->queue_id ? state->queue_id : "NOQUEUE"), state->namaddr, PRINT2_OR_NULL(state->sasl_method, @@ -255,7 +255,10 @@ PRINT2_OR_NULL(HAVE_FORWARDED_IDENT(state), ", orig_queue_id=", FORWARD_IDENT(state)), PRINT2_OR_NULL(HAVE_FORWARDED_CLIENT_ATTR(state), - ", orig_client=", FORWARD_NAMADDR(state))); + ", orig_client=", FORWARD_NAMADDR(state)), + ", helo=", state->helo_name ? state->helo_name : "", + PRINT2_OR_NULL(HAVE_FORWARDED_CLIENT_ATTR(state), + ", orig_helo=", FORWARD_HELO(state) ? FORWARD_HELO(state) : "")); } /* smtpd_sasl_mail_reset - SASL-specific MAIL FROM cleanup */ -- Noel Jones