# Feasibility to send alerts only if consecutive errors are occurred using elastalert

**URL:** <https://discuss.elastic.co/t/feasibility-to-send-alerts-only-if-consecutive-errors-are-occurred-using-elastalert/341485>\
**Category:** Elasticsearch\
**Created:** [August 23, 2023, 1:51pm UTC](https://discuss.elastic.co/t/feasibility-to-send-alerts-only-if-consecutive-errors-are-occurred-using-elastalert/341485 "2023-08-23T13:51:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![prathameshdvk](https://avatars.discourse-cdn.com/v4/letter/p/a87d85/32.png) [@prathameshdvk](https://discuss.elastic.co/u/prathameshdvk)\
**Post date:** [August 23, 2023, 1:51pm UTC](https://discuss.elastic.co/t/feasibility-to-send-alerts-only-if-consecutive-errors-are-occurred-using-elastalert/341485/1 "2023-08-23T13:51:31Z")

</div>

Hi All,

I am trying to setup alerting using elastalert and I am trying to achieve below scenarios.

scenario 1: Send alert if there are 3 consecutive 400 errors. (Which is working fine)

scenario 2: Do not send alert if we get any 200 or success between 3 4xx errors.

Is there any feasibility to do this in elastalert?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [August 23, 2023, 4:04pm UTC](https://discuss.elastic.co/t/feasibility-to-send-alerts-only-if-consecutive-errors-are-occurred-using-elastalert/341485/2 "2023-08-23T16:04:58Z")

</div>

Elastalert is not supported here so I would recommend reaching out to the Elastalert community or the creators.

---

<div class="post-metadata">

**Author:** ![vishalk663](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vishalk663/32/117103_2.png) [@vishalk663](https://discuss.elastic.co/u/vishalk663)\
**Post date:** [September 12, 2023, 6:48am UTC](https://discuss.elastic.co/t/feasibility-to-send-alerts-only-if-consecutive-errors-are-occurred-using-elastalert/341485/3 "2023-09-12T06:48:43Z")

</div>

Hi @Christian_Dahlqvist

Thank you for the reply

Is there any method in elasticsearch to search 3 consecutive 400 errors in specific timeframe without any other 200 responses.

---

<div class="post-metadata">

**Author:** ![vishalk663](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vishalk663/32/117103_2.png) [@vishalk663](https://discuss.elastic.co/u/vishalk663)\
**Post date:** [September 12, 2023, 1:34pm UTC](https://discuss.elastic.co/t/feasibility-to-send-alerts-only-if-consecutive-errors-are-occurred-using-elastalert/341485/4 "2023-09-12T13:34:38Z")

</div>

Actually, we want to check any method or any way is available to search for the below scenarios in elasticsearch

1. it's possible to exclude matches for 5 consecutive 500's **when it's interrupted by** a 200:

```auto
No match: 5 5 5 2 5 5
   Match: 2 5 5 5 5 5
   Match: 5 5 5 5 5 5

```

1. it's possible to exclude matches for 3 consecutive 400 **when it's interrupted by** a 200:

```auto
No Match: 4 4 2 4
No Match: 2 4 4 2
   Match: 4 4 4 

```

---

<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:** [October 10, 2023, 1:34pm UTC](https://discuss.elastic.co/t/feasibility-to-send-alerts-only-if-consecutive-errors-are-occurred-using-elastalert/341485/5 "2023-10-10T13:34:56Z")

</div>

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