It is a simple library to check a list of logs files and send notification about their abnormal activities.
IMPORTANT: It is in development now.
Only Linux is supported now.
API descriptions can be found on godoc.org.
Files for observation can be added using a configuration file, see examples in config.example.json.
Description of "observed" array element:
{
"name": "My service #2", // Service name
"files": [ // watched files
{
"file": "/var/log/syslog", // absolute file path
"pattern": "My service error", // regexp pattern for monitoring
"increase": false, // increase "boundary" value during a time period
"emails": ["[email protected]"], // email addresses for notifications
"boundary": 1, // boundary value for notifications
"period": 3600, // time period
"limit": 6 // maximum emails during a time period
}
]
}
Use standard Go testing mechanism:
cd $GOPATH/src/github.com/z0rr0/logchecker/logchecker
go test
There is a nice article about tests covering.
- standard Go library
- inotify package
There are recommended style guides:
A compliance with the second style guide can be checked using go-lint tool.
This source code is governed by a LGPLv3 license that can be found in the LICENSE file.