How to enable HAProxy Stats Log

We have configured HAProxy for load balancing WEBSockets. We are facing issue saying websocket backend server not available in haproxy log. But Websocket server is up and running. To further debug this problem, need to enable stats log.Can anyone point us to the link on how to configure stats or how to further debug this problem

You can find the details of the logging system in the documentation, section 8 [1].

As an example, here is a basic logging configuration:

global
 log 127.0.0.1 syslog debug
defaults
 log global
 mode http
 option httplog

[1] https://cbonte.github.io/haproxy-dconv/1.7/configuration.html#8

Please download the latest code from the below location.

http://www.haproxy.org/

e.g “http://www.haproxy.org/download/1.7/src/haproxy-1.7.9.tar.gz

and paste this source code on your linux machine.

How to enable Debug Log:

  1. Make changes in Makefile:
    Set parameter: DEBUG= –DDEBUG_FULL (Optionally –DDEBUG_FSM)

  2. Rename file name which is attached with mail (debug_modified.h) to debug.h and replace the debug.h file with /home/user_name/haproxy-1.5.18/include/common/debug.h [In haproxy source code Folder]

  3. Compile Source:
    #make TARGET=linux2628 [whatever kernel version of your Machine but should be higher or equal to linux-2.6.28, in our case it is greater than Ver-2.6.28 for Centos7.x (x is subversion)]

  4. Run Haproxy with command: (It is standalone binary, so not mandatory of haproxy-systemd-wrapper as of now)
    …/Directory_where_haproxy_binary_is/# ./haproxy –f /etc/haproxy/haproxy.cfg –d -V

Note: Log would only for those be created wherever DPRINTF are called in code (For Example Log is thrown on same terminal(tab) in case curl command is fire for checking load balancing).

If you have any confusion then please put on this scrap.

And please like my post