# Email body is it not evaluating %{message}

**URL:** https://discuss.elastic.co/t/email-body-is-it-not-evaluating-message/111180
**Category:** Logstash
**Created:** [December 11, 2017, 9:29pm UTC](https://discuss.elastic.co/t/email-body-is-it-not-evaluating-message/111180 "2017-12-11T21:29:55Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![psosa](https://avatars.discourse-cdn.com/v4/letter/p/cc9497/32.png) [@psosa](https://discuss.elastic.co/u/psosa)
#### Post date: [December 11, 2017, 9:29pm UTC](https://discuss.elastic.co/t/email-body-is-it-not-evaluating-message/111180/1 "2017-12-11T21:29:56Z")

</div>

```
input {
jdbc {
...
...
 statement => "SELECT 70 as value"
}
} output {

stdout { codec => rubydebug }

	email {
          authentication => 'login' 
          from => 'whatever@xxx.com'
          domain => 'xxx.com'         
          address => 'xxx.com'         
      		to => 'juan.xxx@gxxx.com'
      		port => 25
      		username => 'xxx@xxx.com'
			    password => 'yyy'   
          subject => 'Alert - %{title}'
          body => "Tags: %{tags}\n Content: \n %{message} "   
    	}
}

```

I have an output email plugin ... and %{message} it is not evaluating / binding ... I'm getting the text "%{message}."

Any clue ? I'm using logstash 6.0.1

this is the output of stdout

```
{
      "@version" => "1",
    "@timestamp" => 2017-12-11T21:12:44.158Z,
         "value" => 70,
          "tags" => [
        [0] "should_email",
        [1] "loans"
    ]
}
```

---

<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: [December 12, 2017, 6:33am UTC](https://discuss.elastic.co/t/email-body-is-it-not-evaluating-message/111180/2 "2017-12-12T06:33:10Z")

</div>

This indicates that the event doesn't have a `message` field.

---

<div class="post-metadata">

### Author: ![psosa](https://avatars.discourse-cdn.com/v4/letter/p/cc9497/32.png) [@psosa](https://discuss.elastic.co/u/psosa)
#### Post date: [December 12, 2017, 8:33am UTC](https://discuss.elastic.co/t/email-body-is-it-not-evaluating-message/111180/3 "2017-12-12T08:33:29Z")

</div>

I updated the post with more code. If I have an output of stdout, I have message, right ?

---

<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: [December 12, 2017, 8:38am UTC](https://discuss.elastic.co/t/email-body-is-it-not-evaluating-message/111180/4 "2017-12-12T08:38:45Z")

</div>

> I updated the post with more code. If I have an output of stdout, I have message, right ?

No. The output you posted clearly shows that you only have four fields (`@timestamp`, `@version`, `value`, and `tags`). This isn't surprising since you're only selecting a single column in your jdbc input. I don't know what you expect to get in the email.

---

<div class="post-metadata">

### Author: ![psosa](https://avatars.discourse-cdn.com/v4/letter/p/cc9497/32.png) [@psosa](https://discuss.elastic.co/u/psosa)
#### Post date: [December 12, 2017, 10:02am UTC](https://discuss.elastic.co/t/email-body-is-it-not-evaluating-message/111180/5 "2017-12-12T10:02:42Z")

</div>

I see my error now ! Thank you for the clarification !

Is possible to refer all fields ? for example if I want to send rubydebug output or codec as json.

---

<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: [December 12, 2017, 10:48am UTC](https://discuss.elastic.co/t/email-body-is-it-not-evaluating-message/111180/6 "2017-12-12T10:48:51Z")

</div>

I don't think it's possible out of the box; you'll have to assemble a temporary field (e.g. in a subfield of `@metadata`) containing the data you need. You could use a ruby filter to do that.

---

<div class="post-metadata">

### Author: ![psosa](https://avatars.discourse-cdn.com/v4/letter/p/cc9497/32.png) [@psosa](https://discuss.elastic.co/u/psosa)
#### Post date: [December 12, 2017, 11:10am UTC](https://discuss.elastic.co/t/email-body-is-it-not-evaluating-message/111180/7 "2017-12-12T11:10:38Z")

</div>

got you, thank you @magnusbaeck !

---

<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: [January 9, 2018, 11:11am UTC](https://discuss.elastic.co/t/email-body-is-it-not-evaluating-message/111180/8 "2018-01-09T11:11:15Z")

</div>

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