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
如果过滤的字符中有 “汉字”,那么在执行过滤任务的时候会算在内,但是在显示的时候会被忽略
如果过滤的字符中有 “空格”,那么在执行过滤任务的时候回算在内,但是在显示的时候会算成”.”

猜你喜欢

转载自blog.51cto.com/ershao/2123050
今日推荐