# Elasticsearch watcher

**URL:** <https://discuss.elastic.co/t/elasticsearch-watcher/141416>\
**Category:** Elasticsearch\
**Created:** [July 24, 2018, 3:15pm UTC](https://discuss.elastic.co/t/elasticsearch-watcher/141416 "2018-07-24T15:15:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![charan.gandra](https://avatars.discourse-cdn.com/v4/letter/c/a87d85/32.png) [@charan.gandra](https://discuss.elastic.co/u/charan.gandra)\
**Post date:** [July 24, 2018, 3:15pm UTC](https://discuss.elastic.co/t/elasticsearch-watcher/141416/1 "2018-07-24T15:15:43Z")

</div>

Hi,

I've an index with host name, host state and timestamp and , message fields, I want to use watcher to send an alert when a host is down. I can do that using the below watcher.

PUT \_xpack/watcher/watch/log\_error\_watch  
{  
"trigger" : { "schedule" : { "interval" : "10s" }},  
"input" : {  
"search" : {  
"request" : {  
"indices" : ["logs"],  
"body" : {  
"query" : {  
"match" : { "message": "DOWN" }  
}  
}  
}  
}  
},  
"condition" : {  
"compare" : { "ctx.payload.hits.total" : { "gt" : 0 }}  
},  
"actions" : {  
"log\_error" : {  
"logging" : {  
"text" : "Found {{ctx.payload.hits.total}} errors in the logs"  
}  
}  
}  
}

But I want to alert with the name of the host which is DOWN as well. How do I do that?

Thanks,

---

<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 21, 2018, 3:15pm UTC](https://discuss.elastic.co/t/elasticsearch-watcher/141416/2 "2018-08-21T15:15:55Z")

</div>

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