# How to specify number of logstash workers in configuration file?

**URL:** <https://discuss.elastic.co/t/how-to-specify-number-of-logstash-workers-in-configuration-file/32972>\
**Category:** Logstash\
**Created:** [October 26, 2015, 10:31am UTC](https://discuss.elastic.co/t/how-to-specify-number-of-logstash-workers-in-configuration-file/32972 "2015-10-26T10:31:38Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![harshafrnd4u](https://avatars.discourse-cdn.com/v4/letter/h/fbc32d/32.png) [@harshafrnd4u](https://discuss.elastic.co/u/harshafrnd4u)\
**Post date:** [October 26, 2015, 10:31am UTC](https://discuss.elastic.co/t/how-to-specify-number-of-logstash-workers-in-configuration-file/32972/1 "2015-10-26T10:31:38Z")

</div>

is there any way to specify number of filter workers from configuration file. ?

Right now I am using "service logstash start" command to start logstash, can we pass somehow pass number of worker threads to this command?

Thanks  
Harsha

---

<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:** [October 26, 2015, 10:47am UTC](https://discuss.elastic.co/t/how-to-specify-number-of-logstash-workers-in-configuration-file/32972/2 "2015-10-26T10:47:00Z")

</div>

> is there any way to specify number of filter workers from configuration file. ?

No, sorry.

> Right now I am using "service logstash start" command to start logstash, can we pass somehow pass number of worker threads to this command?

Change /etc/default/logstash or /etc/sysconfig/logstash or wherever Logstash's startup arguments are configured on your system.

---

<div class="post-metadata">

**Author:** ![harshafrnd4u](https://avatars.discourse-cdn.com/v4/letter/h/fbc32d/32.png) [@harshafrnd4u](https://discuss.elastic.co/u/harshafrnd4u)\
**Post date:** [October 26, 2015, 10:53am UTC](https://discuss.elastic.co/t/how-to-specify-number-of-logstash-workers-in-configuration-file/32972/3 "2015-10-26T10:53:42Z")

</div>

Thanks for quick response.

I didnt see any configuration specific to worker threads in /etc/default/logstash, Can you please tell me the line which I need to add to specify filter worker threads or I will be thankful if you can point me to some resource which has these info?

---

<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:** [October 26, 2015, 11:39am UTC](https://discuss.elastic.co/t/how-to-specify-number-of-logstash-workers-in-configuration-file/32972/4 "2015-10-26T11:39:36Z")

</div>

There's no separate variable for the number of workers it but you can use LS\_OPTS to pass extra arguments to Logstash (`-w` or `--filterworkers` in this case).

---

<div class="post-metadata">

**Author:** ![harshafrnd4u](https://avatars.discourse-cdn.com/v4/letter/h/fbc32d/32.png) [@harshafrnd4u](https://discuss.elastic.co/u/harshafrnd4u)\
**Post date:** [October 26, 2015, 12:20pm UTC](https://discuss.elastic.co/t/how-to-specify-number-of-logstash-workers-in-configuration-file/32972/5 "2015-10-26T12:20:40Z")

</div>

Thanks Magnus for immediate response

---

<div class="post-metadata">

**Author:** ![pecwich](https://avatars.discourse-cdn.com/v4/letter/p/bc79bd/32.png) [@pecwich](https://discuss.elastic.co/u/pecwich)\
**Post date:** [March 2, 2016, 11:12am UTC](https://discuss.elastic.co/t/how-to-specify-number-of-logstash-workers-in-configuration-file/32972/6 "2016-03-02T11:12:19Z")

</div>

What affect does changing the number of workers in Logstash have on it's performance?

---

<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:** [March 2, 2016, 2:43pm UTC](https://discuss.elastic.co/t/how-to-specify-number-of-logstash-workers-in-configuration-file/32972/7 "2016-03-02T14:43:38Z")

</div>

Increasing the number of pipeline workers is likely to increase the throughput at the cost of higher CPU utilization, but it depends on the specifics.

---

<div class="post-metadata">

**Author:** ![pecwich](https://avatars.discourse-cdn.com/v4/letter/p/bc79bd/32.png) [@pecwich](https://discuss.elastic.co/u/pecwich)\
**Post date:** [March 2, 2016, 4:13pm UTC](https://discuss.elastic.co/t/how-to-specify-number-of-logstash-workers-in-configuration-file/32972/8 "2016-03-02T16:13:08Z")

</div>

But suppose I decrease the number of workers, will it have any issues such  
as memory leak or inability to parse multiline logs?

---

<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:** [March 2, 2016, 6:26pm UTC](https://discuss.elastic.co/t/how-to-specify-number-of-logstash-workers-in-configuration-file/32972/9 "2016-03-02T18:26:03Z")

</div>

Your Logstash instance will most likely have less capacity (i.e. lower throughput) but there won't be any problems with memory leaks or parsing of multiline logs. Why would it?

---

<div class="post-metadata">

**Author:** ![UnitedMarsupials](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/unitedmarsupials/32/19429_2.png) [@UnitedMarsupials](https://discuss.elastic.co/u/UnitedMarsupials)\
**Post date:** [June 28, 2017, 3:24pm UTC](https://discuss.elastic.co/t/how-to-specify-number-of-logstash-workers-in-configuration-file/32972/10 "2017-06-28T15:24:45Z")

</div>

> [@magnusbaeck](#):
>
> `--filterworkers`

The option is now called `--pipeline-workers` -- I'm sure, Magnus knows this, but this page keeps coming up on top of search-results for the question, so I thought, I'll point this out for searchers like myself.

The default number is derived from the number of CPU-cores in the host, which is usually too small if any networking (other than through `localhost`) is involved. If your LS-installation feeds a remote destination -- be it Elasticsearch, or Graphite, or anything running on a separate machine, you should start with the number of workers at _twice_ the number of processors.

---

<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:** [November 4, 2022, 4:08am UTC](https://discuss.elastic.co/t/how-to-specify-number-of-logstash-workers-in-configuration-file/32972/11 "2022-11-04T04:08:10Z")

</div>


