# Logstash output email

**URL:** <https://discuss.elastic.co/t/logstash-output-email/296856>\
**Category:** Logstash\
**Created:** [February 10, 2022, 2:32pm UTC](https://discuss.elastic.co/t/logstash-output-email/296856 "2022-02-10T14:32:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alex\_vermex](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alex_vermex/32/101267_2.png) [@alex\_vermex](https://discuss.elastic.co/u/alex_vermex)\
**Post date:** [February 10, 2022, 2:32pm UTC](https://discuss.elastic.co/t/logstash-output-email/296856/1 "2022-02-10T14:32:54Z")

</div>

Hi,  
I have log file contains more than one exception so i want for this file when i found a word "EXCEPTION" just sending me one email.  
logstash.conf:

```auto
output{
    stdout {
    codec => rubydebug
  }
    if ("EXCEPTION" in [message]) {
    email {
    to => "aa@gmail.com"
    via => 'smtp'
	address => 'smtp.gmail.com'
    domain => 'smtp.gmail.com'
	from => 'jo@gmail.com'
    authentication => "plain"
    username => "jo@gmail.com"
	password => "pass"
	subject => 'Alert '
	body => "there is exception in this file"
	port => 25
	use_tls => true
    }
    }

```

This will give me when i found the word "EXCEPTION" will send me an email it means if i have 40 EXCEPTION in this file will send me 40 emails so i want just one email.

Any help would be sincerely appreciate!  
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:** [March 10, 2022, 2:33pm UTC](https://discuss.elastic.co/t/logstash-output-email/296856/2 "2022-03-10T14:33:50Z")

</div>

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