how to find the load balancer log

Posted March 6, 2021 1.2k views
Load Balancing

I setup a load balancer with 1-click and attached 3 droplets to it. I want to know when a client made a request to the load balancer, which droplet it is connected to. I cannot find it when ssh into the droplet because the tcp connections only show the connection is from[port].

Is there any way I can find out which droplet and which port the client is related?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hi there,

What you could do is to enable PROXY Protocol for the Load balancer.

The PROXY protocol is a way to send client connection information (like origin IP addresses and port numbers) to the final backend server rather than discarding it at the load balancer.

This information can be helpful for use cases like analyzing traffic logs or changing application functionality based on geographical IP.

You can do that by following the steps here:

And then configure your Nginx or Apache services to accept PROXY protocol headers as described here:

Hope that this helps.

  • Thank you! I will take a look at it and let you know if I have any question.

  • I have tried to add the following in /etc/nginx/nginx.conf:

            real_ip_header proxy_protocol;
            listen 443 ssl proxy_protocol;

    Here the internal ip is based from my 3 droplets. However, after I enable proxy for load balancer, it stopped working. The default nginx version is 1.18.0. Also, I have checked:

    nginx -V 2>&1 | grep -- 'http_realip_module' 
    nginx -V 2>&1 | grep -- 'stream_realip_module' 
    (stream_realip_module is not contained by default nginx, but I didn't use the stream directive in nginx.conf)