How logging works (stdout or file or syslog)

Hi everyone,


TL;DR: I found many different configuration examples with various parameters.
For example, I saw either using an address (127.0.0.1) or a directory (/dev/log).
I also saw the suffix local with an arbitrary number (local0, local1,local6 etc.)
Sometimes even the word notice is appended.

Can anyone explain me all those details?


I’m using HAProxy since recently (a dockerized version).
I’m mainly using it as a reverse proxy and SSL termination.
Now I managed to configure it as a basic level, I wanted to view some usage information.

I already managed to view the stats panel after many tries.
Since I wanted to use SSL and a custom subdomain rather the URL path.

But despite my attempts I did not succeed to view the logs (and in fact it would have been very useful to have logs information during all that setup process).

I found many different configuration examples without so much details about the options used (why they are used for example). I couldn’t find anything clear enough (for me) in the documentation

Can anyone explain me how logging directives work?

The only logs I can see for the moment (using the docker own logging feature docker logs container with the parameters found here) are only warnings and alerts upon the startup (or the reload) of HAProxy.
By the way, this helped me very much in order to figure out the errors in my copy/pasted configuration attempts.

However, what I really want are logs upon every connection for example. I’m used to rails server that display many useful information (at least in development environment). I’m aware that for a reverse proxy that is intended to got many many connections, logging all the requests might be too much. But, nevertheless it could be very useful to log at least the errors.

For example, sometimes, for a static website using nginx, I experience a 503 error when I refresh a page that was previously displayed (but that was idle for a moment). I should refresh a second time in order to have the page displayed again. And it happens quite often since I’m editing/refreshing often during the design steps. Without proper logging I cannot figure out where is the problem (nginx or haproxy).

Alternatively, is it possible to let HAProxy kept attached to the terminal? In that case I could see what is happening.

I also tried a docker image that use rsyslog (image rafpe/docker-haproxy-rsyslog), but I failed to get it working. Anyway I’m not fan to have additional processes running in a container (but it’s not that bad than for an application container I think)

Finally I would like to learn how I can configure the logging of HAProxy in my docker environment.

As per the first paragraph in the linked documentation:

You can either log to a syslog server via UDP (IP:port) or UNIX socket, with UDP being recommended as UNIX sockets have all kinds of problems (mainly syslogd restart while haproxy is chrooted and can’t reconnect afterwards and slow syslog servers discarding log messages).

/dev/log is not a file, but a unix socket.

Logging to stdout is not supported.

Appended keywords like local0 and notice are either syslog facilities or security levels:

To log from a docker container, you should use an external syslog. If you need it within the container, check the workarounds proposed here: