What is the difference between 49-haproxy.conf and the haproxy.conf files?

Now I have no idea if this is specific to Ubuntu or if this is in general. The documentation on HAProxy is astoundingly bad. I'm guessing it has something to do with rsyslogd?

The files are normally kept in the /etc/rsyslog.d/ directory.

  • You have provided way too little information. – mbiber Mar 8 '16 at 15:29
  • 1
    Ordering. The "49" will be in a dir that is scanned in alphabetical order. The 49 makes it start before 50* and after 49*. The other one is probably the actual file. and the 49* one a symlink. – Rinzwind Mar 8 '16 at 15:35

From a blog post:

Thanks for this! It saved me a lot of time.

One thing I'd suggest changing -- in Ubuntu Oneiric (and I suspect in older versions), the rsyslogd config you specify will leave haproxy logging in both /var/log/haproxy_1.log and in /var/log/syslog. This is because rsyslogd writes each message out using every rule in its configuration that matches unless specifically told not to.

The "& ~" at the end of your file /etc/rsyslog.d/haproxy.conf means "once you've written something using the rule above, don't process any more rules for this message". But it won't stop messages from being written out by rules that were specified before the one in /etc/rsyslog.d/haproxy.conf

Now, the default Oneiric config has a file called /etc/rsyslog.d/50-default.conf which does the default configuration, including a catch-all "write everything to syslog" rule. And because files from /etc/rsyslog.d/ are included in alphabetical order, the rules in 50-default.conf are applied before the ones in haproxy.conf -- so you get your haproxy stuff dumped into both files.

The solution is obviously to call your own rsyslogd config file something like /etc/rsyslog.d/49-haproxy.conf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.