openfalcon的 日志文件监控 logdog

https://github.com/sdvdxl/falcon-logdog
下载解压后,需要配置一下文件就好了,我的一个典型配置文件如下:
{
"logLevel": "WARN",
"metric": "log",
"timer": 60,
"agent": "http://127.0.0.1:1988/v1/push",
"host": "10.0.100.85",
"files": [
{
"path": "/opt/machtalk/logs/xcloud-cm",
"prefix": "xcloud-cm",
"suffix": "log",
"keywords": [
{
"exp": "closing socket connection and attempting reconnect",
"tag": "error"
},
{
"exp": "服务器下线: null",
"tag": "error"
}
]
},
{
"path": "/opt/abc/logs/xcloud-1",
"prefix": "xcloud-1",
"suffix": "log",
"keywords": [
{
"exp": "closing socket connection and attempting reconnect",
"tag": "error"
}
]
},
{
"path": "/opt/abc/logs/xcloud-2",
"prefix": "xcloud-2",
"suffix": "log",
"keywords": [
{
"exp": "closing socket connection and attempting reconnect",
"tag": "error"
}
]
},
{
"path": "/opt/abc/logs/xcloud-3",
"prefix": "xcloud-3",
"suffix": "log",
"keywords": [
{
"exp": "closing socket connection and attempting reconnect",
"tag": "error"
}
]
}
]
}

上面的配置,是分别针对3个目录,日志有prefix和suffix,进行日志过滤,如果发现 closing socket connection and attempting reconnect, 那么计数器+1.
TIP1
如果过滤的字符中有 “汉字”,那么在执行过滤任务的时候会算在内,但是在显示的时候会被忽略
如果过滤的字符中有 “空格”,那么在执行过滤任务的时候回算在内,但是在显示的时候会算成”.”

转载于:https://blog.51cto.com/ershao/2123050

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值