haproxy

Aggregate logs from haproxy, including HTTP requests and errors.

Intro

haproxy is a “reliable, high Performance TCP/HTTP load balancer.”

Setup

haproxy supports remote syslog natively, so it can log directly to Papertrail. Edit haproxy.cfg and add a new global log configuration option like this, as well as log-send-hostname:

log logsN.papertrailapp.com:XXXXX local0
log-send-hostname

where logsN and XXXXX are the name and port number shown under log destinations.

Second, add log global to each server’s configuration stanza to indicate that it should use the aforementioned configuration.

haproxy supports up to 2 concurrent log configuration outputs.

Read more: log configuration option

Optional: define syslog tag and/or hostname

Syslog messages include a program name (“tag”) and sender identifier (“hostname”). With the configuration above, haproxy will use default values of haproxy and the system hostname. These are typically fine.

Changing the tag is typically only necessary if you run multiple haproxy instances on the same system. Use different tag values to tell their logs apart.

Changing the hostname is rarely needed, since the system hostname is usually the best identification.

To change them, use the [log-tag ](http://cbonte.github.com/haproxy-dconv/configuration-1.5.html#3-log-tag) or [log-send-hostname ](http://cbonte.github.com/haproxy-dconv/configuration-1.5.html#3-log-send-hostname) options.

Optional: change logging verbosity

Optionally append a minimum severity from among the set:

 log logsN.papertrailapp.com:XXXXX local0 warning

where logsN and XXXXX are the name and port number shown under log destinations.

Alternative: use local log file or system syslog

If you do not want to have haproxy log directly to Papertrail, you can use 1 of these 2 methods instead:

More

Official documentation: log