关闭Elastalert几天,现在它正在查询我关闭后的所有数据



我正在测试弹性警报,在假期周末之前的周三出现了一个奇怪的问题,所以我只是删除了所有警报配置并重新启动了弹性警报,所以它在周末没有警报。现在在周一,我重新打开了它,它查询了自周三以来的所有日志,花了很长时间才赶上。我只想查询最近的数据。这是背景吗?如果需要,如何禁用它?

以下是警报配置示例:

name: alert-name
type: frequency
num_events: 500
timeframe:
minutes: 60
realert:
minutes: 60
index: index.name-*
filter:
- query:
query_string:
query: "message:"Message" AND context.debug.type.something"
alert_subject: "This alert happened"
alert:
- pagerduty:
pagerduty_service_key: "nice_try_fbi"
pagerduty_client_name: "company"

这是我在日志中看到的(今天是11/26(

INFO:elastalert:Queried rule alert-name from 2018-11-22 12:49 UTC to 2018-11-22 13:04 UTC: 83 / 83 hits
INFO:elastalert:Queried rule alert-name from 2018-11-22 13:04 UTC to 2018-11-22 13:19 UTC: 83 / 83 hits
INFO:elastalert:Queried rule alert-name from 2018-11-22 13:19 UTC to 2018-11-22 13:34 UTC: 89 / 89 hits
INFO:elastalert:Queried rule alert-name from 2018-11-22 13:34 UTC to 2018-11-22 13:49 UTC: 91 / 91 hits
INFO:elastalert:Queried rule alert-name from 2018-11-22 13:49 UTC to 2018-11-22 14:04 UTC: 87 / 87 hits

看看它是如何以15分钟为增量查询4天前的内容的?时间范围设置为60分钟。我只想查询最近的60分钟。我是不是遗漏了什么?

我找到了答案-看起来记得上次运行查询时的"状态"是弹性警报的一个功能,如可靠性下所述:https://github.com/Yelp/elastalert/blob/master/docs/source/elastalert.rst#Reliability

我还发现,它将警报的"状态"存储在其运行的弹性搜索集群的索引中:https://elastalert.readthedocs.io/en/latest/elastalert_status.html

因此,我刚刚删除了elasticsearch中的所有elasticalert*索引,似乎elasticalert将这些警报视为"新"警报,并且自上次成功运行以来没有尝试处理数据。也许还有更好的方法(比如通过警报设置?(,但这对我很有效。

最新更新