# Proxy protocol support for logstash? (ELB and HAProxy for inbound failover)

**URL:** <https://discuss.elastic.co/t/proxy-protocol-support-for-logstash-elb-and-haproxy-for-inbound-failover/38117>\
**Category:** Logstash\
**Created:** [December 29, 2015, 6:29pm UTC](https://discuss.elastic.co/t/proxy-protocol-support-for-logstash-elb-and-haproxy-for-inbound-failover/38117 "2015-12-29T18:29:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![nneul](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nneul/32/4956_2.png) [@nneul](https://discuss.elastic.co/u/nneul)\
**Post date:** [December 29, 2015, 6:29pm UTC](https://discuss.elastic.co/t/proxy-protocol-support-for-logstash-elb-and-haproxy-for-inbound-failover/38117/1 "2015-12-29T18:29:38Z")

</div>

Is there any way to get proxy protocol support for logstash so that the indexer can see the originating IP/host for the connections if you have logstash sitting behind ELB or HAProxy?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [January 5, 2016, 1:38pm UTC](https://discuss.elastic.co/t/proxy-protocol-support-for-logstash-elb-and-haproxy-for-inbound-failover/38117/2 "2016-01-05T13:38:07Z")

</div>

Which inbound protocol(s)?

---

<div class="post-metadata">

**Author:** ![nneul](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nneul/32/4956_2.png) [@nneul](https://discuss.elastic.co/u/nneul)\
**Post date:** [January 5, 2016, 1:57pm UTC](https://discuss.elastic.co/t/proxy-protocol-support-for-logstash-elb-and-haproxy-for-inbound-failover/38117/3 "2016-01-05T13:57:15Z")

</div>

It would technically be for anything TCP based since the protocol (version 1 at least) is just a single line header added to the start of any tcp stream.

For my particular need, having it for the 'tcp', 'log4j', and 'syslog' inputs would cover everything I'm using.

A common use case would be a few logstash forwarders sitting behind an haproxy or Amazon ELB load balancer for failover handling.

From [http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt](http://www.haproxy.org/download/1.5/doc/proxy-protocol.txt) :

`  
The maximum line lengths the receiver must support including the CRLF are :

- TCP/IPv4 :  
"PROXY TCP4 255.255.255.255 255.255.255.255 65535 65535\r\n"  
=\> 5 + 1 + 4 + 1 + 15 + 1 + 15 + 1 + 5 + 1 + 5 + 2 = 56 chars

- TCP/IPv6 :  
"PROXY TCP6 ffff:f...f:ffff ffff:f...f:ffff 65535 65535\r\n"  
=\> 5 + 1 + 4 + 1 + 39 + 1 + 39 + 1 + 5 + 1 + 5 + 2 = 104 chars

- unknown connection (short form) :  
"PROXY UNKNOWN\r\n"  
=\> 5 + 1 + 7 + 2 = 15 chars

- worst case (optional fields set to 0xff) :  
"PROXY UNKNOWN ffff:f...f:ffff ffff:f...f:ffff 65535 65535\r\n"  
=\> 5 + 1 + 7 + 1 + 39 + 1 + 39 + 1 + 5 + 1 + 5 + 2 = 107 chars  
`

---

<div class="post-metadata">

**Author:** ![nneul](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nneul/32/4956_2.png) [@nneul](https://discuss.elastic.co/u/nneul)\
**Post date:** [January 5, 2016, 2:01pm UTC](https://discuss.elastic.co/t/proxy-protocol-support-for-logstash-elb-and-haproxy-for-inbound-failover/38117/4 "2016-01-05T14:01:30Z")

</div>

Note - Amazon only does Proxy protocol v1. HAProxy supports v1 or v2. v2 is a more complex binary format. Support for v1 would be sufficient for now, but keep option for protocol version in mind when implementing configuration syntax.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [January 5, 2016, 2:22pm UTC](https://discuss.elastic.co/t/proxy-protocol-support-for-logstash-elb-and-haproxy-for-inbound-failover/38117/5 "2016-01-05T14:22:24Z")

</div>

Okay. Sounds like something reasonable to support. I suggest filing an issue at [https://github.com/elastic/logstash/issues](https://github.com/elastic/logstash/issues) since it should be included in a core library. I wouldn't assume the team picks up feature requests from here.

---

<div class="post-metadata">

**Author:** ![nneul](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nneul/32/4956_2.png) [@nneul](https://discuss.elastic.co/u/nneul)\
**Post date:** [January 5, 2016, 2:35pm UTC](https://discuss.elastic.co/t/proxy-protocol-support-for-logstash-elb-and-haproxy-for-inbound-failover/38117/6 "2016-01-05T14:35:36Z")

</div>

Submitted

> <https://github.com/elastic/logstash/issues/4418>

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 5:16am UTC](https://discuss.elastic.co/t/proxy-protocol-support-for-logstash-elb-and-haproxy-for-inbound-failover/38117/7 "2017-07-06T05:16:46Z")

</div>


