0

在 cmd 中运行 elastalert Kibana 数据视图 我正在研究使用 elastalert 来提醒获取特定性质或频率的数据。请参阅我的 elastalert 规则 .yaml 文件。

            # Alert when the rate of events exceeds a threshold

            # (Optional)
            # Elasticsearch host
            es_host: localhost

            # (Optional)
            # Elasticsearch port
            es_port: 9200

            # (OptionaL) Connect with SSL to Elasticsearch
            #use_ssl: True

            # (Optional) basic-auth username and password for Elasticsearch
            #es_username: someusername
            #es_password: somepassword

            # (Required)
            # Rule name, must be unique
            name: my_rule

            # (Required)
            # Type of alert.
            # the frequency rule type alerts when num_events events occur with timeframe time
            type: any
            #frequency

            # (Required)
            # Index to search, wildcard supported
            index: shakes*

            # (Required, frequency specific)
            # Alert when this many documents matching the query occur within a timeframe
            num_events: 1

            # (Required, frequency specific)
            # num_events must occur within this amount of time to trigger an alert
            timeframe:
              seconds: 15

            # (Required)
            # A list of Elasticsearch filters used for find events
            # These filters are joined with AND and nested in a filtered query
            # For more info: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl.html
            filter: []
            #- query:
            #   query_string: 
            #      query: "play_name: Henry IV"

            # (Required)
            # The alert is use when a match is found
            alert:
            - "email"

            # (required, email specific)
            # a list of email addresses to send alerts to
            email:
            - "olawi@vg.com"

命中数应该算数。我没有命中。现在,我看到了一个类似的帖子,其中要求开发人员调整时间,因为 elastalert 基于浏览器的时间工作。我调整了系统时间以匹配索引中文档的时间戳,但它仍然没有在该时间段内提供任何命中。

谢谢。

4

1 回答 1

0

Elastic Search、Kibana 和 ELastAlert 默认使用 UTC。因此 ElastAlert 将查询您的 ES 基准 UTC。要求您遵循以下几点。

  • 请检查您的 kibana 使用的是哪个时区(因为您使用的是 Kibana 来检查点击量)。您可以通过 Management Tab ->Advance Settings ->dateFormat:tz来执行此操作。如果不是 UTC,请将其更改为 UTC,然后与 ElastAlert 进行比较。如果有的话,这将使您获得成功。(假设您没有在 ES 架构中指定其他时区。如果完成,请将 Kibana 时区更改为 ES 的时区以检查命中)
  • 如果您的 ES 中的时区与 UTC 不同,请按照此问题寻求解决方案。
  • 此外,您可以检查 ElastAlert 正在使用的 ES 查询,以确保所需的日期时间过滤器进入您的查询。您可以通过更改 ElastAlert 的日志记录级别来做到这一点。请按照操作。

谢谢

于 2018-08-21T08:05:28.820 回答