# Watcher with no data in logs

**URL:** <https://discuss.elastic.co/t/watcher-with-no-data-in-logs/209287>\
**Category:** Kibana\
**Created:** [November 25, 2019, 10:51am UTC](https://discuss.elastic.co/t/watcher-with-no-data-in-logs/209287 "2019-11-25T10:51:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kurdit](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kurdit/32/54994_2.png) [@kurdit](https://discuss.elastic.co/u/kurdit)\
**Post date:** [November 25, 2019, 10:51am UTC](https://discuss.elastic.co/t/watcher-with-no-data-in-logs/209287/1 "2019-11-25T10:51:23Z")

</div>

Hello!

I have a question on condition in watcher. How can I make a condition for triggering a watcher in case there are no data in the logs?  
I have a watcher to send notifications if http codes 200 less than 5.  
how to make the watcher send a notification according to two conditions: if 200 codes are less than 5 and if 200 codes are not in the logs at all for a certain period of time? (there are no documents in the logs at all)

---

<div class="post-metadata">

**Author:** ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)\
**Post date:** [November 25, 2019, 7:55pm UTC](https://discuss.elastic.co/t/watcher-with-no-data-in-logs/209287/2 "2019-11-25T19:55:12Z")

</div>

Hi @kurdit. I think you could use a script condition that accesses the watch payload similar to [this one](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/condition-script.html#accessing-watch-payload) but include an OR (`||`) operator in the script. Something like this.

```auto
{...
      "source" : "return ctx.payload.hits.total < 5 || ctx.payload.hits.total == 0",
...}

```

---

<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:** [December 23, 2019, 7:55pm UTC](https://discuss.elastic.co/t/watcher-with-no-data-in-logs/209287/3 "2019-12-23T19:55:16Z")

</div>

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