GLC-Implement Glog log cleanup

Source: Internet
Author: User
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),})
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.