# IF statement block only if number of messages received

**URL:** <https://discuss.elastic.co/t/if-statement-block-only-if-number-of-messages-received/124582>\
**Category:** Logstash\
**Created:** [March 19, 2018, 2:46pm UTC](https://discuss.elastic.co/t/if-statement-block-only-if-number-of-messages-received/124582 "2018-03-19T14:46:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben19](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ben19/32/3745_2.png) [@Ben19](https://discuss.elastic.co/u/Ben19)\
**Post date:** [March 19, 2018, 2:46pm UTC](https://discuss.elastic.co/t/if-statement-block-only-if-number-of-messages-received/124582/1 "2018-03-19T14:46:47Z")

</div>

Hello, so we have a requirement to forward emails using the logstash email plugin when certain conditions exist. We have been using this for the last few years with no issues, we are looking to try implement an if statement based on the number of messages received. For example, if more than x5 syslogs where the message field contains a string then send via the email output, but only if 5 are received within a certain time-frame. Is this possible?

Thanks

---

<div class="post-metadata">

**Author:** ![wwalker](https://avatars.discourse-cdn.com/v4/letter/w/43a26b/32.png) [@wwalker](https://discuss.elastic.co/u/wwalker)\
**Post date:** [March 19, 2018, 3:16pm UTC](https://discuss.elastic.co/t/if-statement-block-only-if-number-of-messages-received/124582/2 "2018-03-19T15:16:04Z")

</div>

Have you looked at the [Throttle Filter](https://www.elastic.co/guide/en/logstash/current/plugins-filters-throttle.html)?

---

<div class="post-metadata">

**Author:** ![Ben19](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ben19/32/3745_2.png) [@Ben19](https://discuss.elastic.co/u/Ben19)\
**Post date:** [March 19, 2018, 5:10pm UTC](https://discuss.elastic.co/t/if-statement-block-only-if-number-of-messages-received/124582/3 "2018-03-19T17:10:10Z")

</div>

Not yet, will have a read. 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:** [April 16, 2018, 5:10pm UTC](https://discuss.elastic.co/t/if-statement-block-only-if-number-of-messages-received/124582/4 "2018-04-16T17:10:20Z")

</div>

Closed on April 16, 2018, 5:10pm UTC

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