This is a created article in which the information may have evolved or changed.
Project Address
Github.com/xuri/glc
Brief introduction
GLC (Glog Cleaner) is the Go language written glog log cleanup class library, Glog is developed by Google, an application-level log framework, providing log grading, file segmentation and other functions, but does not provide log cleanup function, with GLC can easily implement log cleanup function, class library Provides support for custom log retention times, log file name prefix matching, and cleanup scan frequency.
Installation
go get github.com/xuri/glc
How to use
The following is a simple example of cleaning up logs per hour, leaving only the logs specified in the directory for 30 minutes to glc
be prefixed by glog:
glc.NewGLC(glc.InitOption{ Path: path, Prefix: `glc`, Interval: time.Duration(time.Hours), Reserve: time.Duration(time.Minute * 30),})