# Logstash email output filter not working with variable trigger key

**URL:** https://discuss.elastic.co/t/logstash-email-output-filter-not-working-with-variable-trigger-key/163617
**Category:** Logstash
**Created:** [January 9, 2019, 8:29pm UTC](https://discuss.elastic.co/t/logstash-email-output-filter-not-working-with-variable-trigger-key/163617 "2019-01-09T20:29:03Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![sureshkk252](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sureshkk252/32/79183_2.png) [@sureshkk252](https://discuss.elastic.co/u/sureshkk252)
#### Post date: [January 9, 2019, 8:29pm UTC](https://discuss.elastic.co/t/logstash-email-output-filter-not-working-with-variable-trigger-key/163617/1 "2019-01-09T20:29:04Z")

</div>

Hi, I have configured logstash in a way we can dynamically configure the alert keyword which will send an email when it appears in message.  
My old configuration worked: I got emails when there is ERROR keyword in message

if "ERROR" in [message] {  
email {  
address=\>"[mailsrv.unix.gsm1900.org](http://mailsrv.unix.gsm1900.org)"  
port=\>25  
from =\> "logstash\_alert@t-mobile.com"  
subject =\> "({SPRING\_PROFILES\_ACTIVE}) Logstash Alert from {APPLICATION\_NAME}"  
via =\> "smtp"  
to =\> "{CLIENT\_MAIL}" body =\> "In host {HOST\_IP:HOST\_NOT\_SET} the event line that occurred: %{message}"  
}  
}

New config: It is not sending any emails. I have setup the ERROR key word for this variable in /etc/default/logstash file  
if "{EXCEPTION\_STRING}" in [message] { email { address=\>"mailsrv.unix.gsm1900.org" port=\>25 from =\> "logstash\_alert@t-mobile.com" subject =\> "({SPRING\_PROFILES\_ACTIVE}) Logstash Alert from {APPLICATION\_NAME}" via =\> "smtp" to =\> "{CLIENT\_MAIL}"  
body =\> "In host ${HOST\_IP:HOST\_NOT\_SET} the event line that occurred: %{message}"  
}  
}  
Please help here. Thank you

---

<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: [February 6, 2019, 8:29pm UTC](https://discuss.elastic.co/t/logstash-email-output-filter-not-working-with-variable-trigger-key/163617/2 "2019-02-06T20:29:11Z")

</div>

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