My logging setup is a single Docker host with UDP 514 exposed for syslog. An nginx container has its port published so when you send logs to 10.1.1.100 (in the image below) it first hits nginx, whose config for transparent load balancing to Logstash containers is:
user root;
events {worker_connections 32768;}
stream {
upstream logstash_servers {
server logstash-collector-01:514;
server logstash-collector-02:514;
server logstash-collector-03:514;
}
listen 514 udp;
proxy_pass logstash_servers;
proxy_bind $remote_addr transparent;
}
}
This works fine. However, TCP 514 (or anything TCP, for that matter) doesn't. Even when I add the right listener and configs, I believe the TCP handshake does not complete because with nginx doing transparent load balancing, its proxy_bind passes along, e.g. 10.1.1.5 as a source IP to e.g. 172.18.0.4 (a Logstash instance). That instance then tries to complete the handshake but 10.1.1.5 (and any routers along the way) does not know how to route to the Docker network of 172.18.0.0/16.
Is there a solution here to be able to use TCP for logging?