Turgon37 / docker-smtp-relay

Docker image running a SMTP relay with postfix
MIT License
67 stars 33 forks source link

lost connection after CONNECT from localhost[127.0.0.1] #19

Open eloirobe opened 4 years ago

eloirobe commented 4 years ago

Hello just start the image with docker run -p 25:25 -e "RELAY_MYDOMAIN=domain.com" -e "RELAY_HOST=relay:25" turgon37/smtp-relay

Appears this log message

2020-09-23T13:20:44.588007+00:00 813952df60c9 postfix/smtpd[132]: disconnect from localhost[127.0.0.1] commands=0/0 2020-09-23T13:20:49.666838+00:00 813952df60c9 postfix/smtpd[132]: connect from localhost[127.0.0.1] 2020-09-23T13:20:49.666968+00:00 813952df60c9 postfix/smtpd[132]: lost connection after CONNECT from localhost[127.0.0.1] 2020-09-23T13:20:49.666984+00:00 813952df60c9 postfix/smtpd[132]: disconnect from localhost[127.0.0.1] commands=0/0 2020-09-23T13:20:54.766237+00:00 813952df60c9 postfix/smtpd[132]: connect from localhost[127.0.0.1] 2020-09-23T13:20:54.766333+00:00 813952df60c9 postfix/smtpd[132]: lost connection after CONNECT from localhost[127.0.0.1] 2020-09-23T13:20:54.766343+00:00 813952df60c9 postfix/smtpd[132]: disconnect from localhost[127.0.0.1] commands=0/0 2020-09-23T13:20:59.863704+00:00 813952df60c9 postfix/smtpd[132]: connect from localhost[127.0.0.1] 2020-09-23T13:20:59.863809+00:00 813952df60c9 postfix/smtpd[132]: lost connection after CONNECT from localhost[127.0.0.1] 2020-09-23T13:20:59.863831+00:00 813952df60c9 postfix/smtpd[132]: disconnect from localhost[127.0.0.1] commands=0/0 2020-09-23T13:21:04.958953+00:00 813952df60c9 postfix/smtpd[132]: connect from localhost[127.0.0.1] Is it normal?

Turgon37 commented 4 years ago

Hello theses messages are caused by the container healthcheck https://github.com/Turgon37/docker-smtp-relay/blob/master/Dockerfile#L76 I cannot prevent theses messages to occurs, and in fact healthcheck ensure that postfix is running and able to receive incoming mails and can inform your containers orchestrator of this healthy state.

schiegg commented 3 years ago

Hi everybody, are these messages logged in any form running in deamon (-d) mode or just written on command line and if they are logged, is there any log rotation and deletion by default or will my container grow in size slowly till its bursting? ;-)

borice commented 3 years ago

I was able to silence these healthcheck logs through rsyslog filtering. Here's the updated /etc/rsyslog.conf ruleset at the bottom which shows how I filter out these annoying healthcheck-related messages:

ruleset(name="process_logs") {
  # discard log messages generated by health check
  :msg, contains, "connect from localhost" stop
  :msg, contains, "lost connection after CONNECT from localhost" stop
  :msg, contains, "disconnect from localhost" stop

  # copy all messages to stdout
  action(
    type="omfile"
    name="output_logs_stdout"
    File="/proc/self/fd/1"
  )
}

You can create a custom rsyslog.conf file which you can then mount in /etc/rsyslog.conf to replace the image-provided one.