首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >elastalert发送多个电子邮件警报,而不是发送聚合的电子邮件

elastalert发送多个电子邮件警报,而不是发送聚合的电子邮件
EN

Stack Overflow用户
提问于 2021-01-21 21:39:46
回答 1查看 260关注 0票数 0

ElastAlert不是发送一个警报,而是为映射的每个文档发送电子邮件。下面是我的规则文件。它的工作,但我希望在一个电子邮件的警报。请帮忙,任何建议都将不胜感激。

代码语言:javascript
复制
skynet.yaml: |-
    ---
    name: skynet
    type: frequency
    limit_execution: "0/10 * * * *"
    index: wpng-httpd-perf-*
    num_events: 1
    top_count_keys: ["Host_Id", "Host_Group"]
    timeframe:
      minutes: 15   
    filter:
    - query:
        query_string:
            query: "Host_Group.keyword:ZOOKEEPER_ZK1_QA"
    alert:
    - "email"
    email_format: html
    aggregation:
      minutes: 15
    aggregation_key: 'Host_Id'
    email:
    - "johndoe@skynet.com"          
    from_addr: "sam@skynet.com"
    alert_subject: "PLOT1 at {0}."
    alert_subject_args:
    - "@timestamp"
    alert_text: "Hi Team,<br><br/> {0} ERROR event(s) detected in last 15 minutes <br/><br>Hosts where errors are detected :</br> Host_Id is {1} <br></br><br></br> <br>Here are a few of those :</br><br> messages {2} </br><br> </br><br/><br>bye.</br><br></br><br>Thanks <br></br> "
    alert_text_type: alert_text_only
    alert_text_args:
    - num_matches
    - Host_Id
    - message
    - top_count_keys
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-01-22 20:04:17

下面的代码对我很有效。

代码语言:javascript
复制
 PLOTTHREE.yaml: |-
---
name: PLOTTHREE
type: frequency
limit_execution: "0/15 * * * *"
index: home-*
num_events: 1
aggregation:
  minutes: 10
include:
  - Host_Group
  - Host_Id
timeframe:
  minutes: 15   
filter:
- query:
    query_string:
        query: "Host_Group.keyword:fatal"
alert:
- "email"
email:
- "john@doe.com"          
from_addr: "yyy@doe.com"
alert_subject: "PLOTTHREE - ERROR detected in Kafka Zookeeper logs of host group fatal at {0}."
alert_subject_args:
- "@timestamp"
alert_text: "Hello Team, ERROR event(s) detected in last 15 minutes. Hosts where errors are detected in {0}. Here is the num events {1} . "
alert_text_type: alert_text_only
alert_text_args:
- Host_Id
- num_matches
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65828681

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档