# Threshold and Timeframe in custom detection rule

**URL:** <https://discuss.rapid7.com/t/threshold-and-timeframe-in-custom-detection-rule/36611>\
**Category:** Alerts\
**Tags:** InsightIDR\
**Created:** [April 30, 2024, 7:31am UTC](https://discuss.rapid7.com/t/threshold-and-timeframe-in-custom-detection-rule/36611 "2024-04-30T07:31:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vvivek.halpatrao](https://discuss.rapid7.com/letter_avatar_proxy/v4/letter/v/e8c25b/32.png) [@vvivek.halpatrao](https://discuss.rapid7.com/u/vvivek.halpatrao)\
**Post date:** [April 30, 2024, 7:31am UTC](https://discuss.rapid7.com/t/threshold-and-timeframe-in-custom-detection-rule/36611/1 "2024-04-30T07:31:38Z")

</div>

Hello everyone,  
I am creating custom detection rule that generates alert when user login with invalid credential more than 5 times within 30 min. I have login\_time ( Datetime ).  
For this I had written logic and using following:  
group by : user\_name  
Set Threshold : This rule will detect only once on match 6.  
Timeframe : 30 min.

But The logs we are receiving are not realtime, all yesterdays logs ingested in Rapid7 in a batch.  
The Timeframe this rule should consider is login\_time of that user. But it seems it is taking ingestion time and as logs are coming in batches ingestion time for all the logs is almost same and hence it may be generating false alert.

Is there anyway to use login\_time to set threshold or any other way to full fill this requirement. Because even if I fetch only time from login\_time it will not give me that rolling effect for 30 min as should start counting 30 min where user invalid login first time.

---

<div class="post-metadata">

**Author:** ![david\_smith](https://discuss.rapid7.com/letter_avatar_proxy/v4/letter/d/a3d4f5/32.png) [@david\_smith](https://discuss.rapid7.com/u/david_smith)\
**Post date:** [April 30, 2024, 3:13pm UTC](https://discuss.rapid7.com/t/threshold-and-timeframe-in-custom-detection-rule/36611/2 "2024-04-30T15:13:59Z")

</div>

@vvivek.halpatrao how are these logs being transmitted that they are delayed so significantly?

What you are describing is not currently possible

---

<div class="post-metadata">

**Author:** ![vvivek.halpatrao](https://discuss.rapid7.com/letter_avatar_proxy/v4/letter/v/e8c25b/32.png) [@vvivek.halpatrao](https://discuss.rapid7.com/u/vvivek.halpatrao)\
**Post date:** [April 30, 2024, 3:21pm UTC](https://discuss.rapid7.com/t/threshold-and-timeframe-in-custom-detection-rule/36611/3 "2024-04-30T15:21:44Z")

</div>

I didn’t know that much about ingestion as it is handled by another team. I think files are not getting delayed it is done knowingly.  
But please can you confirm that Timeframe in threshold is take ingestion time or not ? And is there any way to achieve above requirement
