Recently, HAProxy 1.9 was released to the public. One of the enhancements this release has had, is to the way it logs: HAProxy is now able to log to stdout and stderr. Logging to stdout or stderr is important for container environments, like Docker.

To enable logging to stdout, use the stdout parameter:

log stdout local0

It works the same with stderr. An alternative way to do that is to log to a file descriptor as shown:

log fd@1 local0

The fd@1 parameter is an alias for stdout and fd@2 is an alias for stderr. This change also comes with two new log formats:

  • raw
  • short

Where raw works well with Docker, and short works well with systemd.

log stdout format raw local0

In my case, I have logging set up as follows:

  log stdout format raw local0
  log stderr format raw local1

See the release blog post for more information.