我正在尝试使用观察者 API 发送警报。
https://www.elastic.co/guide/en/elasticsearch/reference/5.5/watcher-api-put-watch.html
我可以设置一个如上所述的例子。当我检查我的邮件时,我可以正确地看到“主题”行。但我需要查询的输出作为电子邮件的正文。这是如何使用 x-pack 实现的?
我正在尝试使用观察者 API 发送警报。
https://www.elastic.co/guide/en/elasticsearch/reference/5.5/watcher-api-put-watch.html
我可以设置一个如上所述的例子。当我检查我的邮件时,我可以正确地看到“主题”行。但我需要查询的输出作为电子邮件的正文。这是如何使用 x-pack 实现的?
在文档的示例中,它仅指定了主题。
您可以在此页面 中看到带有正文的示例: 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"
}
}
]
...