# Load balancer for multi logstash

**URL:** <https://discuss.elastic.co/t/load-balancer-for-multi-logstash/277071>\
**Category:** Logstash\
**Created:** [June 25, 2021, 1:49pm UTC](https://discuss.elastic.co/t/load-balancer-for-multi-logstash/277071 "2021-06-25T13:49:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![alicango](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alicango/32/84498_2.png) [@alicango](https://discuss.elastic.co/u/alicango)\
**Post date:** [June 25, 2021, 1:49pm UTC](https://discuss.elastic.co/t/load-balancer-for-multi-logstash/277071/1 "2021-06-25T13:49:49Z")

</div>

Hi,  
We have 2 Logstash servers. I want to put them behind a load balancer and push the data to the logstash over the HTTPS. But now, I am using the HTTP input plugin without a load balancer.  
Let me show you my HTTPS configuration steps;  
**in logstash1 server:**

```auto
mkdir /etc/logstash/certs
cd /etc/logstash/certs
openssl req -days 3650 -x509 -newkey rsa:4096 -keyout logstash1-key.pem -out logstash1-cert.pem -nodes
chmod 644 logstash1-key.pem

```

**in logstash2 server:**  
i applied same steps but just replaced openssl command whit this;  
`openssl req -days 3650 -x509 -newkey rsa:4096 -keyout logstash2-key.pem -out logstash2-cert.pem -nodes`

**config file;**  
**Note:** Each logstash server(1 and 2) has same config except _ **ssl\_certificate** _ and _ **ssl\_key** _

```auto
input {
  http {
    port => 9605
    user => "happylogstash"
    password => "${LS_PWD}"
    ssl => true
    ssl_verify_mode => "none"
    ssl_certificate => "/etc/logstash/certs/logstash1-cert.pem"
    ssl_key => "/etc/logstash/certs/logstash1-key.pem"
    codec => "json"
  }
}

```

Finally, i set the logstash's fqdn in **/etc/hosts** in a different server where I send data to logstash by using logstash's fqdn instead of IP.

```auto
cat /etc/hosts
127.0.0.1 localhost localhost.localdomain
::1 localhost localhost.localdomain

# Logstash
10.0.1.2 logstash1.com
10.0.1.3 logstash2.com

```

And i send data like this;  
`curl -XPOST -k -u 'happylogstash:anypassword' 'https://logstash1.com:9605' -d '{"my": "data"}'`

or  
`curl -XPOST -k -u 'happylogstash:anypassword' 'https://logstash2.com:9605' -d '{"my": "data"}'`

My question is what should I make changes in my configuration if use a load balancer's fqdn instead of using logstash's fqdn directly?

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [June 25, 2021, 3:01pm UTC](https://discuss.elastic.co/t/load-balancer-for-multi-logstash/277071/2 "2021-06-25T15:01:38Z")

</div>

That would depend in how you will use your Load Balancer.

Are you going to terminate the SSL/TLS connection at the Load Balancer? Pass-through the request from the client to the server or open the request and reencrypt it again?

If you are going to terminate the SSL/TLS connection at the Load Balancer, then you would not need to use the ssl options of the http input in logstash.

If you are going to pass-through the connection, then I think that you do not need to change anything in the logstash side, the same thing if you open and reencrypt it again, but in this case you would need to configura the logstash ssl in the load balancer.

This is more an infrastructure/network question, it depends on the load balancer configuration and which tool are you using as a load balancer.

---

<div class="post-metadata">

**Author:** ![alicango](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alicango/32/84498_2.png) [@alicango](https://discuss.elastic.co/u/alicango)\
**Post date:** [June 27, 2021, 8:16pm UTC](https://discuss.elastic.co/t/load-balancer-for-multi-logstash/277071/3 "2021-06-27T20:16:17Z")

</div>

We will use F5 with SSL offloading most likely. Also, we just want to send a request with HTTPS and user/password both. (without SSL verification) like this;  
**From a client server:**  
`curl -XPOST -k -u 'happylogstash:anypassword' 'https://myF5balancer:9605' -d '{"my": "data"}'`

---

<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 25, 2021, 8:16pm UTC](https://discuss.elastic.co/t/load-balancer-for-multi-logstash/277071/4 "2021-07-25T20:16:38Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
