# Logstash Output Plugin Batch Events / De-Register Method

**URL:** <https://discuss.elastic.co/t/logstash-output-plugin-batch-events-de-register-method/27291>\
**Category:** Logstash\
**Created:** [August 12, 2015, 8:24pm UTC](https://discuss.elastic.co/t/logstash-output-plugin-batch-events-de-register-method/27291 "2015-08-12T20:24:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rishi](https://avatars.discourse-cdn.com/v4/letter/r/90db22/32.png) [@rishi](https://discuss.elastic.co/u/rishi)\
**Post date:** [August 12, 2015, 8:24pm UTC](https://discuss.elastic.co/t/logstash-output-plugin-batch-events-de-register-method/27291/1 "2015-08-12T20:24:54Z")

</div>

I'm working on an output plugin for logstash and was wondering if the events that the ruby script receives can be batched (multiple events in place of the `receive(event)` method that gives a single event)?

---

<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:** [August 13, 2015, 6:09am UTC](https://discuss.elastic.co/t/logstash-output-plugin-batch-events-de-register-method/27291/2 "2015-08-13T06:09:24Z")

</div>

No, you'd have to do such batching internally.

---

<div class="post-metadata">

**Author:** ![rishi](https://avatars.discourse-cdn.com/v4/letter/r/90db22/32.png) [@rishi](https://discuss.elastic.co/u/rishi)\
**Post date:** [August 13, 2015, 7:36pm UTC](https://discuss.elastic.co/t/logstash-output-plugin-batch-events-de-register-method/27291/3 "2015-08-13T19:36:58Z")

</div>

Thanks, @magnusbaeck.

Do you know if there is a `deregister` method for the output plugins that is the opposite of `register`; something similar to the `PreDestroy` annotated methods in Java? I have a resource entity that I am planning on initializing in the register method but do not want to close it every time, since the batch won't be full in one `receive` call.

---

<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:** [August 13, 2015, 7:39pm UTC](https://discuss.elastic.co/t/logstash-output-plugin-batch-events-de-register-method/27291/4 "2015-08-13T19:39:57Z")

</div>

I don't know, sorry.

---

<div class="post-metadata">

**Author:** ![rishi](https://avatars.discourse-cdn.com/v4/letter/r/90db22/32.png) [@rishi](https://discuss.elastic.co/u/rishi)\
**Post date:** [August 13, 2015, 8:35pm UTC](https://discuss.elastic.co/t/logstash-output-plugin-batch-events-de-register-method/27291/5 "2015-08-13T20:35:23Z")

</div>

Nm, there is a `teardown` method in the Plugin class that can be overridden for this purpose. Thanks!

---

<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 6, 2017, 5:32am UTC](https://discuss.elastic.co/t/logstash-output-plugin-batch-events-de-register-method/27291/6 "2017-07-06T05:32:02Z")

</div>

Closed on July 6, 2017, 5:32am UTC


