On Thu, Jun 19, 2014 at 09:51:39AM +0200, Alvaro Mar?n wrote:

> The problem is that there is no way to see what has happened with an
> email searching the queue ID in the logs (in scripts or apps to trace
> emails, for example). It would be usefull add that queue ID to the "lost
> connection error", something like:
> 
> Jun 19 08:43:55 postfix/smtpd[26460]: 7EAD855B8355: lost connection
> after DATA (17 bytes) from unknown[x]

It was far from clear you were asking for a queue-id here, that's
possible, but would likely require changes in existing log parsing
scripts.  Not sure this is sufficiently compelling...

--- a/postfix/src/smtpd/smtpd.c
+++ b/postfix/src/smtpd/smtpd.c
@@ -4893,13 +4893,15 @@ static void smtpd_proto(SMTPD_STATE *state)
      */
     if (state->reason && state->where) {
        if (strcmp(state->where, SMTPD_AFTER_DATA) == 0) {
-           msg_info("%s after %s (%lu bytes) from %s", /* 2.5 compat */
+           msg_info("%s: %s after %s (%lu bytes) from %s", /* 2.5 compat */
+                    (state->queue_id ? state->queue_id : "NOQUEUE"),
                     state->reason, SMTPD_CMD_DATA,     /* 2.5 compat */
                     (long) (state->act_size + vstream_peek(state->client)),
                     state->namaddr);
        } else if (strcmp(state->where, SMTPD_AFTER_DOT)
                   || strcmp(state->reason, REASON_LOST_CONNECTION)) {
-           msg_info("%s after %s from %s",
+           msg_info("%s: %s after %s from %s",
+                    (state->queue_id ? state->queue_id : "NOQUEUE"),
                     state->reason, state->where, state->namaddr);
        }
     }

> In this specific case, I could search with the smtpd PID but I guess
> that is not unique.

My "collate" Perl script posted previously to this list may be helpful.

-- 
        Viktor.

Reply via email to