# Create 1 alert monitor for missing logs on multiple index

**URL:** <https://discuss.elastic.co/t/create-1-alert-monitor-for-missing-logs-on-multiple-index/324526>\
**Category:** Kibana\
**Tags:** elastic-stack-alerting\
**Created:** [February 2, 2023, 10:37am UTC](https://discuss.elastic.co/t/create-1-alert-monitor-for-missing-logs-on-multiple-index/324526 "2023-02-02T10:37:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![crimson589](https://avatars.discourse-cdn.com/v4/letter/c/edb3f5/32.png) [@crimson589](https://discuss.elastic.co/u/crimson589)\
**Post date:** [February 2, 2023, 10:37am UTC](https://discuss.elastic.co/t/create-1-alert-monitor-for-missing-logs-on-multiple-index/324526/1 "2023-02-02T10:37:49Z")

</div>

v7.8.0

I have a monitor setup on one index that basically checks if the count of a log is not 0 for the past 10 minutes. I just pick one index and setup the query like below. I set the trigger condition to `(ctx.results[0].hits.total.value == 0)`, If no "Successful transaction." logs are found then I get alerted in a slack channel

```auto
{
    "size": 0,
    "query": {
        "bool": {
            "must": [
                {
                    "match_all": {
                        "boost": 1
                    }
                },
                {
                    "match_phrase": {
                        "message": {
                            "query": "Successful transaction.",
                            "slop": 0,
                            "zero_terms_query": "NONE",
                            "boost": 1
                        }
                    }
                },
                {
                    "range": {
                        "@timestamp": {
                            "from": "now-10m",
                            "to": "now",
                            "include_lower": true,
                            "include_upper": true,
                            "boost": 1
                        }
                    }
                }
            ],
            "adjust_pure_negative": true,
            "boost": 1
        }
    }
}

```

Now my problem is I want to create the same alert for other indices but if I do that and there was an issue with logs coming in to kibana then I'll get spammed by messages from multiple monitors, is there a way to monitor multiple indices with just one monitor and I get alerted like "This index has no logs..."

---

<div class="post-metadata">

**Author:** ![richcollier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/richcollier/32/115035_2.png) [@richcollier](https://discuss.elastic.co/u/richcollier)\
**Post date:** [February 2, 2023, 6:47pm UTC](https://discuss.elastic.co/t/create-1-alert-monitor-for-missing-logs-on-multiple-index/324526/2 "2023-02-02T18:47:11Z")

</div>

maybe model your Watch after this example:

> <https://gist.github.com/richcollier/32d291d9b960d903864113a211dbbb23>

---

<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:** [March 2, 2023, 6:47pm UTC](https://discuss.elastic.co/t/create-1-alert-monitor-for-missing-logs-on-multiple-index/324526/3 "2023-03-02T18:47:35Z")

</div>

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