2

We need to ensure that HAProxy logs are actually written to disk successfully before handing over the coming requests to our servers behind it. In other words, we need HAProxy to log synchronously and block until logs are written to disk safely. Is this possible? How?

Thank you!

2 Answers 2

3

@geeko,

HAProxy doesn't do any logging to disk, ONLY to syslog.

From the 1.7 Management Manual, but it's the same for all versions:

For logging, HAProxy always relies on a syslog server since it does not perform any file-system access. The standard way of using it is to send logs over UDP to the log server (by default on port 514). Very commonly this is configured to 127.0.0.1 where the local syslog daemon is running, but it's also used over the network to log to a central server.

1

Given that logs are not written locally to the disk from HAProxy and only sent via syslog (and usually over UDP), there is no real way to absolutely guarantee that every single log seen by haproxy is written.

In fact, when you start hammering 10's of millions of requests per load balancer to a single point, you might find that garbage collection on your syslog receiver can even cause logs to drop.

For example, we estimate that we lose around 30,000 log entries a day due to garbage collection (this is a tiny fraction of what we see from our haproxy machines, and we consider it to be within the acceptable margin of error)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .