请教下watcher webhook报警问题,我想在body内得到相应字段值如何取得?利用{{_source.src_ip}}这种方式sentinel可以用,watcher下怎么取得
"actions": {
"my-logging-action": {
"webhook": {
"scheme": "http",
"host": " 10.0.0.55",
"port": 8080,
"method": "post",
"path": "/{{watch_id}}",
"params": {},
"headers": {
"Content-Type": "application/json"
},
"body": "{\r\n \"msgtype\": \"markdown\",\r\n \"at\": {\r\n \"isAtAll\": \"True\"\r\n },\r\n \"markdown\": {\r\n \"title\": \"异常消息\",\r\n \"text\": \" 发现网络攻击: \\n {{#ctx.payload.hits.total}} \r\n 攻击源IP为:{{_source.src_ip}},防护动作: \r\n {{_source.action}}, \r\n 攻击地区:{{_source.geoip.country_name}}, \r\n 攻击次数:{{_source.attack_cout}}, \r\n{{/ctx.payload.hits.total}}\"\r\n }\r\n}"
}
}
}
"actions": {
"my-logging-action": {
"webhook": {
"scheme": "http",
"host": " 10.0.0.55",
"port": 8080,
"method": "post",
"path": "/{{watch_id}}",
"params": {},
"headers": {
"Content-Type": "application/json"
},
"body": "{\r\n \"msgtype\": \"markdown\",\r\n \"at\": {\r\n \"isAtAll\": \"True\"\r\n },\r\n \"markdown\": {\r\n \"title\": \"异常消息\",\r\n \"text\": \" 发现网络攻击: \\n {{#ctx.payload.hits.total}} \r\n 攻击源IP为:{{_source.src_ip}},防护动作: \r\n {{_source.action}}, \r\n 攻击地区:{{_source.geoip.country_name}}, \r\n 攻击次数:{{_source.attack_cout}}, \r\n{{/ctx.payload.hits.total}}\"\r\n }\r\n}"
}
}
}
1 个回复
xm110224 - 运维人员
赞同来自: