# Terminate Logstash when using pipeline-to-pipelines communication

**URL:** <https://discuss.elastic.co/t/terminate-logstash-when-using-pipeline-to-pipelines-communication/238110>\
**Category:** Logstash\
**Created:** [June 22, 2020, 3:16pm UTC](https://discuss.elastic.co/t/terminate-logstash-when-using-pipeline-to-pipelines-communication/238110 "2020-06-22T15:16:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![glenacota](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/glenacota/32/41367_2.png) [@glenacota](https://discuss.elastic.co/u/glenacota)\
**Post date:** [June 22, 2020, 3:16pm UTC](https://discuss.elastic.co/t/terminate-logstash-when-using-pipeline-to-pipelines-communication/238110/1 "2020-06-22T15:16:11Z")

</div>

Hi, this is a duplicated of a question I posted last year, and yet unanswered/unsolved ([original question](https://discuss.elastic.co/t/shutdown-logstash-when-using-pipeline-to-pipelines-communication/205431)).

I would like to use one of the pipeline-to-pipeline architecture patterns, say, the forked path pattern. The input of the upstream pipeline is a one-time query to an Elasticsearch cluster, using the elasticsearch input plugin. Although the number of inputs to downstream is finite, Logstash does not terminate when the downstream pipelines have consumed and processed all the inputs (as it would terminate, if I don't use pipeline-to-pipeline solutions).

Is there a way to force Logstash termination when all the downstream pipelines have processed all the events coming from upstream?

Thanks

---

<div class="post-metadata">

**Author:** ![glenacota](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/glenacota/32/41367_2.png) [@glenacota](https://discuss.elastic.co/u/glenacota)\
**Post date:** [June 26, 2020, 2:27pm UTC](https://discuss.elastic.co/t/terminate-logstash-when-using-pipeline-to-pipelines-communication/238110/2 "2020-06-26T14:27:39Z")

</div>

Hi there! I tried to ask this question at the latest Elastic{ON}, but they couldn't give me an answer 🙃 So here I am again to the community!

[Looking at the code](https://github.com/elastic/logstash/blob/e9c9865f4066b54048f8d708612a72d25e2fe5d9/logstash-core/lib/logstash/plugins/builtin/pipeline/output.rb), I don't see any parameter to request Logstash termination once (1) the upstream pipeline has sent out all the event s and (2) all downstream pipelines have consumed all the sent events.

If this is the intended behaviour, do you know what is the rationale behind it, and how I can hack around it?

---

<div class="post-metadata">

**Author:** ![glenacota](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/glenacota/32/41367_2.png) [@glenacota](https://discuss.elastic.co/u/glenacota)\
**Post date:** [July 6, 2020, 8:34am UTC](https://discuss.elastic.co/t/terminate-logstash-when-using-pipeline-to-pipelines-communication/238110/3 "2020-07-06T08:34:42Z")

</div>

Hi there, a quick update: the order of execution of the pipelines doesn't have an impact on the p2p communication behaviour I'm referring to in this thread.

More in details, I noticed that the (alphabetical) ordering of my pipelines was executing a downstream pipeline before the upstream one. My hope was that this was the reason for the p2p communication termination to stall. Henceforth, I imposed a more coherent order of execution (by changing the name of the pipelines), but I didn't observe the desired behaviour - i.e., Logstash terminates when the upstream pipeline has terminated its job.

I'll keep you posted if something else comes up. If you have any idea, please be my guest 🙂

---

<div class="post-metadata">

**Author:** ![glenacota](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/glenacota/32/41367_2.png) [@glenacota](https://discuss.elastic.co/u/glenacota)\
**Post date:** [July 23, 2020, 10:49am UTC](https://discuss.elastic.co/t/terminate-logstash-when-using-pipeline-to-pipelines-communication/238110/4 "2020-07-23T10:49:04Z")

</div>

Hi everyone, I don't have any update on this, but I would like to give this thread one last chance of visibility before it gets closed.

(I'm not going to "cheat" like today again. So, if there won't be any ideas/thoughts about my question in one month, and the topic will be closed for inactivity, so be it 🙂 it'd mean that the problem wasn't that important, after all)

---

<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 20, 2020, 10:49am UTC](https://discuss.elastic.co/t/terminate-logstash-when-using-pipeline-to-pipelines-communication/238110/5 "2020-08-20T10:49:18Z")

</div>

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