# Create a rule to detect number of beats

**URL:** <https://discuss.elastic.co/t/create-a-rule-to-detect-number-of-beats/270366>\
**Category:** SIEM\
**Created:** [April 16, 2021, 9:28am UTC](https://discuss.elastic.co/t/create-a-rule-to-detect-number-of-beats/270366 "2021-04-16T09:28:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abdelhalim](https://avatars.discourse-cdn.com/v4/letter/a/838e76/32.png) [@Abdelhalim](https://discuss.elastic.co/u/Abdelhalim)\
**Post date:** [April 16, 2021, 9:28am UTC](https://discuss.elastic.co/t/create-a-rule-to-detect-number-of-beats/270366/1 "2021-04-16T09:28:04Z")

</div>

Hello,

I would like to create a new rule to detect if one of my beats stop sending data to my Cluster (one rule for each beat).  
For example I have installed packetbeat in 5 machines, and then the rule will verify each 1 minutes the number of `agent.host` (by aggregation) and if it's less than 5, then it will send me an alert.

Could you please tell me how can I create this kind of alerts

Thanks in advance 🙂

---

<div class="post-metadata">

**Author:** ![Felix\_Roessel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felix_roessel/32/41623_2.png) [@Felix\_Roessel](https://discuss.elastic.co/u/Felix_Roessel)\
**Post date:** [April 17, 2021, 6:54pm UTC](https://discuss.elastic.co/t/create-a-rule-to-detect-number-of-beats/270366/2 "2021-04-17T18:54:47Z")

</div>

Which version of Elastic are you running?  
You should use the latest version and using the threshold based rule.

---

<div class="post-metadata">

**Author:** ![Abdelhalim](https://avatars.discourse-cdn.com/v4/letter/a/838e76/32.png) [@Abdelhalim](https://discuss.elastic.co/u/Abdelhalim)\
**Post date:** [April 19, 2021, 6:03am UTC](https://discuss.elastic.co/t/create-a-rule-to-detect-number-of-beats/270366/3 "2021-04-19T06:03:39Z")

</div>

thanks for your answer @Felix_Roessel ,

But if I understand well, in the threshold based rule I can only use `greater than` and there is no way to say `less than` !!

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/1/f1e848b491d119eca2b36d33d834714b96987e04.png)

---

<div class="post-metadata">

**Author:** ![Felix\_Roessel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felix_roessel/32/41623_2.png) [@Felix\_Roessel](https://discuss.elastic.co/u/Felix_Roessel)\
**Post date:** [April 19, 2021, 7:59am UTC](https://discuss.elastic.co/t/create-a-rule-to-detect-number-of-beats/270366/4 "2021-04-19T07:59:05Z")

</div>

Oh yes, you are right.  
In that case I would recommend choosing an ML based rule. The job will check for the normal amount of events / beats / hosts and inform you whenever there is a change.

Its the easiest way to do so.

---

<div class="post-metadata">

**Author:** ![Abdelhalim](https://avatars.discourse-cdn.com/v4/letter/a/838e76/32.png) [@Abdelhalim](https://discuss.elastic.co/u/Abdelhalim)\
**Post date:** [April 28, 2021, 8:37am UTC](https://discuss.elastic.co/t/create-a-rule-to-detect-number-of-beats/270366/5 "2021-04-28T08:37:15Z")

</div>

Thanks @Felix_Roessel ,  
I did as your suggested and now it's working 😊

---

<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:** [May 26, 2021, 8:38am UTC](https://discuss.elastic.co/t/create-a-rule-to-detect-number-of-beats/270366/6 "2021-05-26T08:38:06Z")

</div>

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