diff --git a/internal/smtpsrv/conn.go b/internal/smtpsrv/conn.go index 24ba3e2..456b42e 100644 --- a/internal/smtpsrv/conn.go +++ b/internal/smtpsrv/conn.go @@ -147,7 +147,6 @@ loop: break } - commandCount.Add(cmd, 1) if cmd == "AUTH" { c.tr.Debugf("-> AUTH ") } else { @@ -187,10 +186,14 @@ loop: c.writeResponse(221, "Be seeing you...") break loop default: + // Sanitize it a bit to avoid filling the logs and events with + // noisy data. Keep the first 6 bytes for debugging. + cmd = fmt.Sprintf("unknown<%.6s>", cmd) code = 500 msg = "unknown command" } + commandCount.Add(cmd, 1) if code > 0 { c.tr.Debugf("<- %d %s", code, msg)