# Unable to print Error message into a watcher alert

**URL:** https://discuss.elastic.co/t/unable-to-print-error-message-into-a-watcher-alert/278765
**Category:** Elasticsearch
**Tags:** elastic-stack-alerting
**Created:** [July 15, 2021, 10:30am UTC](https://discuss.elastic.co/t/unable-to-print-error-message-into-a-watcher-alert/278765 "2021-07-15T10:30:06Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Diyatom](https://avatars.discourse-cdn.com/v4/letter/d/e47c2d/32.png) [@Diyatom](https://discuss.elastic.co/u/Diyatom)
#### Post date: [July 15, 2021, 10:30am UTC](https://discuss.elastic.co/t/unable-to-print-error-message-into-a-watcher-alert/278765/1 "2021-07-15T10:30:06Z")

</div>

Hi,

I want to print out the error message from my logs into my mail. However, its giving me this error.

![image](https://us1.discourse-cdn.com/elastic/original/3X/c/1/c1a507009657de5930119db5243586cb851334f9.png)

Below is the alert jason code i am using:

![image](https://us1.discourse-cdn.com/elastic/original/3X/a/5/a5b26233cdcbd7e271f868e4126448ddf6c5ca56.png)

Can you please help. I am new in elastic search and am trying to print out the error message from the logs.

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [July 15, 2021, 12:09pm UTC](https://discuss.elastic.co/t/unable-to-print-error-message-into-a-watcher-alert/278765/2 "2021-07-15T12:09:54Z")

</div>

Please refrain from using screenshots, but share via code snippets. Thanks!

The shown output is not enough to verify. Is it possible that you set `size: 0` in your query and thus no hits are returned?

Please share the whole JSON from the execute watch API or the watch history otherwise. Thanks!

---

<div class="post-metadata">

### Author: ![Diyatom](https://avatars.discourse-cdn.com/v4/letter/d/e47c2d/32.png) [@Diyatom](https://discuss.elastic.co/u/Diyatom)
#### Post date: [July 22, 2021, 4:46pm UTC](https://discuss.elastic.co/t/unable-to-print-error-message-into-a-watcher-alert/278765/3 "2021-07-22T16:46:10Z")

</div>

> [@spinscale](#):
>
> The shown output is not enough to verify. Is it possible that you set `size: 0` in your query and thus no hits are returned?

Thanks. Setting the size to 1 got me to print the first line of the Error message. Is there a way i can print the entire error log. For example a multi line java error

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [July 23, 2021, 8:04am UTC](https://discuss.elastic.co/t/unable-to-print-error-message-into-a-watcher-alert/278765/4 "2021-07-23T08:04:33Z")

</div>

Can you share the output of the [Execute Watch API](https://www.elastic.co/guide/en/elasticsearch/reference/7.13/watcher-api-execute-watch.html)?

---

<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 20, 2021, 8:04am UTC](https://discuss.elastic.co/t/unable-to-print-error-message-into-a-watcher-alert/278765/5 "2021-08-20T08:04:38Z")

</div>

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