# Load balance the events between the Logstash hosts

**URL:** <https://discuss.elastic.co/t/load-balance-the-events-between-the-logstash-hosts/44952>\
**Category:** Beats\
**Created:** [March 21, 2016, 7:01am UTC](https://discuss.elastic.co/t/load-balance-the-events-between-the-logstash-hosts/44952 "2016-03-21T07:01:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sumantha\_Kannantha](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@Sumantha\_Kannantha](https://discuss.elastic.co/u/Sumantha_Kannantha)\
**Post date:** [March 21, 2016, 7:01am UTC](https://discuss.elastic.co/t/load-balance-the-events-between-the-logstash-hosts/44952/1 "2016-03-21T07:01:54Z")

</div>

This is regarding load balancing option we have for filebeat.

logstash:  
hosts: ["host1:5044","host2:5044"]  
loadbalance: true

What will be the algorithm it will be using if we enable load balance?  
We are using codec =\> multiline in loagstash.  
beats {  
port =\> 9400  
ssl =\> true  
ssl\_certificate =\> "/etc/logstash/server.crt"  
ssl\_key =\> "/etc/logstash/server.key"  
#type =\> "syslog"  
codec =\> multiline {  
# Grok pattern names are valid! 🙂  
pattern =\> "^%{TIMESTAMP\_ISO8601} |^%{DATA}\s\*-\s\*%{DATESTAMP}"  
negate =\> true  
what =\> previous  
}

If we enable loadbalance in filebeat and if we are using above multiline filter in logstash , will it create any confusion if multiple log lines get delivered to different logstash instance?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [March 21, 2016, 7:09am UTC](https://discuss.elastic.co/t/load-balance-the-events-between-the-logstash-hosts/44952/2 "2016-03-21T07:09:20Z")

</div>

Multiline processing is ideally done as close to the source as possible as it removes the need to keep events ordered at later stages. As Fliebeat now supports [multiline processing](https://www.elastic.co/guide/en/beats/filebeat/current/configuration-filebeat-options.html#multiline) before sending events off to Logstash, I would recommend doing the processing there instead of in Logstash if possible. This would allow load balancing between Logstash instances without causing errors.

---

<div class="post-metadata">

**Author:** ![Sumantha\_Kannantha](https://avatars.discourse-cdn.com/v4/letter/s/df788c/32.png) [@Sumantha\_Kannantha](https://discuss.elastic.co/u/Sumantha_Kannantha)\
**Post date:** [March 21, 2016, 10:48am UTC](https://discuss.elastic.co/t/load-balance-the-events-between-the-logstash-hosts/44952/3 "2016-03-21T10:48:15Z")

</div>

Thank you

---

<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 5, 2017, 9:54pm UTC](https://discuss.elastic.co/t/load-balance-the-events-between-the-logstash-hosts/44952/4 "2017-07-05T21:54:27Z")

</div>


