【问题标题】:query output to email action查询输出到电子邮件操作
【发布时间】:2017-09-09 09:06:17
【问题描述】:

我正在尝试使用 watcher API 发送警报。

https://www.elastic.co/guide/en/elasticsearch/reference/5.5/watcher-api-put-watch.html

我可以设置一个如上所述的示例。当我检查我的邮件时,我可以正确地看到“主题”行。但我需要查询的输出作为电子邮件的正文。 这是如何使用 x-pack 实现的?

【问题讨论】:

    标签: elasticsearch elasticsearch-x-pack


    【解决方案1】:

    在文档的示例中,它只指定了主题。

    您可以在此页面中查看带有 body 的示例: https://www.elastic.co/guide/en/x-pack/5.5/actions-email.html

    它指定正文,并将 JSON 格式的响应添加到电子邮件的附件中。

    ...
    "actions" : {
        "email_administrator" : {
          "email" : {
            "to" : "sys.admino@host.domain",
            "subject" : "Encountered {{ctx.payload.hits.total}} errors",
            "body" : "Too many error in the system, see attached data",
            "attachments" : {
              "attached_data" : {
                "data" : {
                  "format" : "json"
                }
              }
            },
            "priority" : "high"
          }
        }
    ]
    ...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-10-23
      • 2012-10-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多