Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I see tcp connection debugging info in HAProxy

Tags:

haproxy

I am currently refactoring a haproxy configuration that we use on our production servers to forward TCP traffic from a central server. The goal is to get everything working with docker containers to help with deployment reliability.

Everything has gone well so far, but now I have a couple of "listen" proxies using "mode tcp" that don't seem to be forwarding their traffic. I think the issue is either in the SSL certificate verification or in the forwarding to the secondary server itself.

In an attempt to debug the issue, I have turned on all syslog debugging ('debug' level) and have used the -d flag to run haproxy in debug mode. This provides extensive debugging information for all incoming http traffic, but doesn't seem to give me anything for TCP.

The lack of debug output for TCP forwarding is something I have run into in the past and have not found any way to get more details.

Is there some set of magic flags, configuration, or compile options I can use to see the full details of the TCP connection processing? (ex: accept, handshake, SSL cert verification, forwarding, timeouts, etc)

like image 994
Allen Avatar asked Mar 13 '14 21:03

Allen


People also ask

How do I view HAProxy logs?

When you are troubleshooting HAProxy using its log file, examine /var/log/haproxy. log for errors using a tool like tail or less . For example, to view the last two lines of the log using tail , run the following command: sudo tail -n 2 /var/log/haproxy.

How do I enable HAProxy logs?

To configure HAProxy's logging directives, open /etc/haproxy/haproxy. cfg in vi or your preferred editor: sudo vi /etc/haproxy/haproxy.

What is the use of HAProxy?

HAProxy (High Availability Proxy) is open source proxy and load balancing server software. It provides high availability at the network (TCP) and application (HTTP/S) layers, improving speed and performance by distributing workload across multiple servers.


1 Answers

If you are using a TCP mode proxy, you have to specify option tcplog in your frontend's definition. This enables tcp mode logging. There's extensive documentation about this in the haproxy manual, for example here for haproxy 1.5: http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#8.2.2

like image 80
arnuschky Avatar answered Oct 29 '22 04:10

arnuschky