# Flush Logstash-output-email Queue

**URL:** https://discuss.elastic.co/t/flush-logstash-output-email-queue/94517
**Category:** Logstash
**Created:** [July 25, 2017, 4:36pm UTC](https://discuss.elastic.co/t/flush-logstash-output-email-queue/94517 "2017-07-25T16:36:18Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Nishant\_Kumar1](https://avatars.discourse-cdn.com/v4/letter/n/4af34b/32.png) [@Nishant\_Kumar1](https://discuss.elastic.co/u/Nishant_Kumar1)
#### Post date: [July 25, 2017, 4:36pm UTC](https://discuss.elastic.co/t/flush-logstash-output-email-queue/94517/1 "2017-07-25T16:36:18Z")

</div>

I configured Filebeats to add new Logfiles in the harvestors' path and restarted the filebeat service on those instances from where the Logs were to be harvested.

On the Logstash side, I configured the Logstash-output-email plugin to send out an email once a 500 error is encountered in the message. What I didn't apprehend beforehand was that the harvesting would start from the beginning of the Logfiles. What I am trying to achieve is to harvest only for new entries and not the existing logs.

Now the real problem is that, Once the emails started coming in , they are not stopping at all eventhough I have commented the email output code in Logstash. I am assuming the emails because of the older logs have queued in and are coming out in humongous amounts. Is there any way to flush the email queue ?

---

<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: [July 26, 2017, 7:50am UTC](https://discuss.elastic.co/t/flush-logstash-output-email-queue/94517/2 "2017-07-26T07:50:30Z")

</div>

> On the Logstash side, I configured the Logstash-output-email plugin to send out an email once a 500 error is encountered in the message.

That's a really bad idea since there, as you've noticed, won't be any rate-limiting. If you receive thousands or even millions of bad requests you will get thousands or even millions of email messages.

> Is there any way to flush the email queue ?

That depends on where the email queue resides. Is it under your control at all or are you sending the messages via your ISP or similar?

---

<div class="post-metadata">

### Author: ![Nishant\_Kumar1](https://avatars.discourse-cdn.com/v4/letter/n/4af34b/32.png) [@Nishant\_Kumar1](https://discuss.elastic.co/u/Nishant_Kumar1)
#### Post date: [July 26, 2017, 10:54am UTC](https://discuss.elastic.co/t/flush-logstash-output-email-queue/94517/3 "2017-07-26T10:54:20Z")

</div>

I have used the via = \>"smtp" to send the emails through. I am not sure if I can control that queue .

---

<div class="post-metadata">

### Author: ![Nishant\_Kumar1](https://avatars.discourse-cdn.com/v4/letter/n/4af34b/32.png) [@Nishant\_Kumar1](https://discuss.elastic.co/u/Nishant_Kumar1)
#### Post date: [July 26, 2017, 11:11am UTC](https://discuss.elastic.co/t/flush-logstash-output-email-queue/94517/4 "2017-07-26T11:11:58Z")

</div>

If not that, I went through the Metric filter, and have just one question.

If I put a metric for a condition , e.g. 20 consecutive 500 errors in a minute, then how can I access the messages for those events ?

---

<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: [July 26, 2017, 11:23am UTC](https://discuss.elastic.co/t/flush-logstash-output-email-queue/94517/5 "2017-07-26T11:23:07Z")

</div>

> I have used the via = \>"smtp" to send the emails through. I am not sure if I can control that queue .

And what SMTP server?

---

<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 23, 2017, 11:23am UTC](https://discuss.elastic.co/t/flush-logstash-output-email-queue/94517/6 "2017-08-23T11:23:37Z")

</div>

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