我有一个 ELK 堆栈。在两台 Logstash 主机前面,我设置了两个 NGINX 负载均衡器作为透明代理。UDP 流量正在发挥作用。TCP 与配置一起工作:
stream {
upstream syslog {
server sapvmlogstash01.sa.projectplace.com:514;
server sapvmlogstash02.sa.projectplace.com:514;
}
server {
listen 514;
proxy_pass syslog;
}
}
Run Code Online (Sandbox Code Playgroud)
但我得到的是 LB 的 source_ip 和 source_host 而不是输入服务器的 IP。
设置相同的添加proxy_bind $remote_addr transparent;不起作用,抛出超时。
*1 upstream timed out (110: Connection timed out) while connecting to upstream, client: $SOURCEHOST_IP, server: 0.0.0.0:514, upstream: "$LOGSTASH_IP:514", bytes from/to client:0/0, bytes from/to upstream:0/0
Run Code Online (Sandbox Code Playgroud)
我尝试从这里设置 TPROXY: https: //www.nginx.com/blog/ip-transparency-direct-server-return-nginx-plus-transparent-proxy/
Logstash 主机:
route add default gw $NGINX_IP
route del default gw $DEFAULT_GW …Run Code Online (Sandbox Code Playgroud)