# Send message to email from watcher

**URL:** <https://discuss.elastic.co/t/send-message-to-email-from-watcher/29627>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [September 19, 2015, 9:19am UTC](https://discuss.elastic.co/t/send-message-to-email-from-watcher/29627 "2015-09-19T09:19:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Asim\_Husanovic](https://avatars.discourse-cdn.com/v4/letter/a/f14d63/32.png) [@Asim\_Husanovic](https://discuss.elastic.co/u/Asim_Husanovic)\
**Post date:** [September 19, 2015, 9:19am UTC](https://discuss.elastic.co/t/send-message-to-email-from-watcher/29627/1 "2015-09-19T09:19:08Z")

</div>

Dear all,

I made one watcher for try to find specific sentence from my logs:

> "query": {  
> "match": {  
> "Message": "Remote Desktop Services: User authentication succeeded"  
> }

Now, I want to parse rest of this log message and send to email like:  
User successfully connected via RDP on from \<remote\_host\>

I have a plan to make a one new watcher for unsuccessfully connection. It is necessary, or maybe I can write it inside this watcher?

How can I get username, hostname and remote\_host in my BODY?

---

<div class="post-metadata">

**Author:** ![uboness](https://avatars.discourse-cdn.com/v4/letter/u/96bed5/32.png) [@uboness](https://discuss.elastic.co/u/uboness)\
**Post date:** [September 21, 2015, 1:49pm UTC](https://discuss.elastic.co/t/send-message-to-email-from-watcher/29627/2 "2015-09-21T13:49:09Z")

</div>

Hi,

Ideally the message processing would be done at ingestion time extracting the fields from the message and adding them as fields to the document.

Otherwise, you can consider using a script [transform](https://www.elastic.co/guide/en/watcher/current/transform.html#transform) construct. You can use the [script transform](https://www.elastic.co/guide/en/watcher/current/transform.html#transform-script) where the script will process the text, extract the metadata and return a new structured payload that can easily be used by the actions.

---

<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:** [July 6, 2017, 1:48pm UTC](https://discuss.elastic.co/t/send-message-to-email-from-watcher/29627/3 "2017-07-06T13:48:35Z")

</div>


