title: Nginx load balancer not passing original IP address
body: <p>We are load balancing syslog traffic with nginx, but right now the syslog server sees all events coming from the IP address of <em>the nginx load balancer</em>.  How do I have the nginx "proxy_pass" method keep the source IP intact?</p>
  
  <p><strong>nginx.conf (source IP ends up as nginx's)</strong></p>
  
  <pre><code>events {
     worker_connections 1024;
  }
  stream {
     upstream logstash_servers {
        server logstash-collector-01:514 max_fails=2 fail_timeout=5s;
        server logstash-collector-02:514 max_fails=2 fail_timeout=5s;
     }
     server {
        listen 514;
        proxy_pass logstash_servers;
     }
  }
  </code></pre>
  
  <p>In another answer I found someone used "proxy_bind $remote_addr transparent;" but when I tried that my syslog server received <em>nothing</em> -- uncommenting the line went back to normal (where the source IP was still wrong).</p>
  
  <p><strong>nginx.conf (nothing gets passed to upstream servers):</strong></p>
  
  <pre><code>events {
     worker_connections 1024;
  }
  stream {
     upstream logstash_servers {
        server logstash-collector-01:514 max_fails=2 fail_timeout=5s;
        server logstash-collector-02:514 max_fails=2 fail_timeout=5s;
     }
     server {
        listen 514;
        proxy_pass logstash_servers;
        proxy_bind $remote_addr transparent;
     }
  }
  </code></pre>