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
stderr. Logging to
stderris important for container environments, like Docker.
Recently, I have been looking into HAProxy as an alternative load balancer to NGINX. NGINX’ free version lacks features vital to a multi-container environment. The most important features we need are upstream health checks and sticky sessions.
The official HAProxy docker image does not really offer an out-of-the-box way to get to HAProxy’s logs other than sending it to a remote log server. Sending log messages to stdout/stderr so you can view the logs with
docker logsdoes not appear to be possible with HAProxy.