码迷,mamicode.com
首页 > 其他好文 > 详细

logstash获取异常日志推送钉钉

时间:2020-04-03 10:25:45      阅读:280      评论:0      收藏:0      [点我收藏+]

标签:url   token   deb   out   content   内容   href   获取   pos   

logstash.conf配置
input {
file {
path => "/data/home/services/xxx/logs/xxx.log"
#path => "/opt/test.log"
#设置logstash开始读取文件内容位置,begining为从头开始,end为只读取最新数据
start_position => "end"
}
}

output {
if ‘"errorCode":1306‘ in [message] {
#stdout { codec => rubydebug }
http {
url => "https://oapi.dingtalk.com/robot/send?access_token=xxx"
http_method => "post"
content_type => "application/json; charset=utf-8"
format => "message"
message => ‘{"msgtype":"text","text":{"content": "音视频播放异常: service:xxx ip:172.17.8.226 APP_LOG errcode is 1306"}}‘
}
}else if ‘"errorCode" : "1307"‘ in [message] {
http {
url => "https://oapi.dingtalk.com/robot/send?access_token=xx"
http_method => "post"
content_type => "application/json; charset=utf-8"
format => "message"
message => ‘{"msgtype":"text","text":{"content": "音视频播放异常: service:xx-api ip:172.17.8.226 APP_LOG errcode is 1307"}}‘
}
}
}

logstash获取异常日志推送钉钉

标签:url   token   deb   out   content   内容   href   获取   pos   

原文地址:https://blog.51cto.com/haoyonghui/2484422

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!