# Filebeat Loadbalancing not working

**URL:** <https://discuss.elastic.co/t/filebeat-loadbalancing-not-working/142478>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [August 1, 2018, 6:43am UTC](https://discuss.elastic.co/t/filebeat-loadbalancing-not-working/142478 "2018-08-01T06:43:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hangstl](https://avatars.discourse-cdn.com/v4/letter/h/f17d59/32.png) [@hangstl](https://discuss.elastic.co/u/hangstl)\
**Post date:** [August 1, 2018, 6:43am UTC](https://discuss.elastic.co/t/filebeat-loadbalancing-not-working/142478/1 "2018-08-01T06:43:10Z")

</div>

I have setup a Logstash Cluster in Google Cloud that sits behind a Load Balancer and uses **Autoscaling** (-\> when the load gets to high new instances are started up automatically).

Unfortunately this does not work properly with Filebeat. Filebeat only hits those Logstash Vms that existed when I started up Filebeat.

**Example:**  
Lets assume I initially have those 3 Logstash hosts running:  
Host1  
Host2  
Host3

When I startup Filebeat, it correctly distributes the messages to Host1, Host2 and Host3.

Now the Autoscaling kicks and and spins up 2 more instances, Host4 and Host5.

Unfortunately Filebeat still only sends messages to Host1, Host2 and Host3. The new hosts, Host4 and Host5, are ignored.

When I now restart Filebeat it sends messages to all 5 hosts!

**So it seems Filebeat only sends messages to those hosts that have been running when Filebeat starts up.**

My filebeat.yml looks like this:

```
filebeat.inputs:
- type: log
  paths:
  ...
  ...
  
output.logstash:
  hosts: ["logstash-loadbalancer:5044", "logstash-loadbalancer:5044"]
  worker: 1
  ttl: 2s
  loadbalance: true

```

I have added the same host (the loadbalancer) twice because I've read in the forums that otherwise Filebeat won't loadbalance messages -\> I can confirm that.

But still loadbalancing seems to not work properly, e.g. TTL seems not to be respected because it always targets the same connections.

---

<div class="post-metadata">

**Author:** ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)\
**Post date:** [August 1, 2018, 4:02pm UTC](https://discuss.elastic.co/t/filebeat-loadbalancing-not-working/142478/2 "2018-08-01T16:02:47Z")

</div>

Looks like this was answered on GH in:

> <https://github.com/elastic/beats/issues/7824#issuecomment-409553329>

---

<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:** [August 29, 2018, 4:02pm UTC](https://discuss.elastic.co/t/filebeat-loadbalancing-not-working/142478/3 "2018-08-29T16:02:48Z")

</div>

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