如何根据Kibana Watcher Action的条件成功将电子邮件警报发送给组
我能够将各种错误分类---
类似----
错误时,即“键” =“响应状态代码不显示成功服务” ----将电子邮件发送到第1组[ [email  proceeded] , 保护] , email 
[电子邮件 受 错误,即“键” =“响应状态代码不表示成功网关” ----将电子邮件发送到第2组[ [email  preected] ,]
"actions": {
"send_email": {
"throttle_period_in_millis": 300000,
"condition": {
"script": {
"source": " def status = false; for(int i=0; i<ctx.payload.failure_request.aggregations.categories.buckets.length;i++) {if(ctx.payload.failure_request.aggregations.categories.buckets[i].key.contains('Response status code does not indicate success')) {status = true}} return status ",
"lang": "painless"
}
},
"email": {
"profile": "standard",
"to": [
"[email protected]"
],
"subject": "{{ctx.metadata.email_subject}}",
"body": {
"html": "Error Found: <ul> {{ctx.payload.aggregations.categories.buckets.length}}"
}
}
}
}
当通过条件通过时,即使键包含该消息时,也将发送给给定的电子邮件。 但是我想一次,根据特定组的消息匹配发送电子邮件。
如果我们有一些无痛的语言来编写逻辑(例如案例语句),那么任何人都可以帮助我。
感谢您的帮助。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这些是我的建议,希望能为您提供帮助。
解决方案一: 与字符串
解决方案两个: 与a,b,c和d(例如
该代码尚未测试,您可能有语法错误。
These is my advice, I hope that can help you.
solution one: match with a string
solution two: match with multiple values like a,b,c and d
the code has not been tested, you may have syntax errors.