# Email plugin not working

**URL:** https://discuss.elastic.co/t/email-plugin-not-working/92776
**Category:** Logstash
**Created:** [July 12, 2017, 8:09am UTC](https://discuss.elastic.co/t/email-plugin-not-working/92776 "2017-07-12T08:09:13Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![desai.amogh](https://avatars.discourse-cdn.com/v4/letter/d/e0b2c6/32.png) [@desai.amogh](https://discuss.elastic.co/u/desai.amogh)
#### Post date: [July 12, 2017, 8:09am UTC](https://discuss.elastic.co/t/email-plugin-not-working/92776/1 "2017-07-12T08:09:13Z")

</div>

I tried this without success.

```
 output 
   {
          elasticsearch 
    	    {
                hosts => ["localhost:9200"]
                index => "logstash-%{+YYYY.MM.dd}"
            }

       file 
		{
           path => "/var/log/logstash/output_line.log"
           codec => "line"
        }

       stdout 
		{
            codec => rubydebug
        }

    if "alert" in [tags] 
	{
       email 
	    {
         to => 'to.user@domain.com'
         from => 'no-reply@domain.com'
         subject => 'Alert - %{title} %{LOGLEVEL} %{IP} %{TIMESTAMP_ISO8601}'
         body => "Tags: %{tags}\\n\\Content:\\n%{message}"
         domain => 'smtp.domain.com'
         port => 25
        }
    }
}
```

---

<div class="post-metadata">

### Author: ![JKhondhu](https://avatars.discourse-cdn.com/v4/letter/j/ed655f/32.png) [@JKhondhu](https://discuss.elastic.co/u/JKhondhu)
#### Post date: [July 12, 2017, 8:25am UTC](https://discuss.elastic.co/t/email-plugin-not-working/92776/2 "2017-07-12T08:25:20Z")

</div>

Hi,

What do you mean by not working? What do you see in the logs?

---

<div class="post-metadata">

### Author: ![desai.amogh](https://avatars.discourse-cdn.com/v4/letter/d/e0b2c6/32.png) [@desai.amogh](https://discuss.elastic.co/u/desai.amogh)
#### Post date: [July 12, 2017, 2:52pm UTC](https://discuss.elastic.co/t/email-plugin-not-working/92776/3 "2017-07-12T14:52:57Z")

</div>

Below is my latest output setting. For both Slack as well as email, the messages get delivered but the subject/body is not parsed with actual error messages or %{variables}

Vesrsion of `logstash 2.2.4`

```
 slack {
    url => "https://hooks.slack.com/services/G53JLWEF65/B534583M/BoJ03273hdbsdfyt38tUE0bfqKK3"
    format => "%{message}"
  }
       email
            {
         to => 'to.user@domain.com'
         from => 'no-reply@domain.com'
         subject => 'Alert - %{title} %{LOGLEVEL} %{IP} %{TIMESTAMP_ISO8601}'
         body => "%{message}"
         domain => 'smtp.domain.com'
         port => 25
        }

```

For example in Slack the message is just `%{message}`  
On Email Subject is `Alert - %{title} %{LOGLEVEL} %{IP} %{TIMESTAMP_ISO8601}` and body is `%{message}` on every message

---

<div class="post-metadata">

### Author: ![desai.amogh](https://avatars.discourse-cdn.com/v4/letter/d/e0b2c6/32.png) [@desai.amogh](https://discuss.elastic.co/u/desai.amogh)
#### Post date: [July 14, 2017, 7:48am UTC](https://discuss.elastic.co/t/email-plugin-not-working/92776/4 "2017-07-14T07:48:36Z")

</div>

This fixed it:

`body => "%{log-level} at %{@timestamp} on %{type} \n Message: %{information}"`

I guess, it's happening because my GROK filter named %{LOGLEVEL:log-leve} and %{GREEDYDATA:information} and so on.

---

<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 11, 2017, 7:48am UTC](https://discuss.elastic.co/t/email-plugin-not-working/92776/5 "2017-08-11T07:48:53Z")

</div>

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