【问题标题】:Turned off Elastalert for a couple days, now its querying all data since I turned it off关闭 Elastalert 几天,现在它查询我关闭后的所有数据
【发布时间】:2018-11-26 22:14:25
【问题描述】:

我正在测试 elastalert,在假期周末之前的星期三出现了一个奇怪的问题,所以我刚刚删除了所有警报配置并重新启动了 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 分钟。我在这里遗漏了什么吗?

【问题讨论】:

    标签: elastalert


    【解决方案1】:

    我找到了答案 - 看起来记住上次查询运行时间的“状态”是 elastalert 的一项功能,正如此处在可靠性下指定的那样:https://github.com/Yelp/elastalert/blob/master/docs/source/elastalert.rst#Reliability

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

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

    【讨论】:

    • 只需使用不同的“警报名称”即可解决您的问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-01-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-22
    • 1970-01-01
    相关资源
    最近更新 更多