natefinch / lumberjack

lumberjack is a log rolling package for Go
MIT License
4.76k stars 585 forks source link

Will you support merging gzip files? #129

Open sequix opened 3 years ago

sequix commented 3 years ago

From I know gzip support this kind of usage:

$ echo -n aaa >1
$ echo bbb >2
$ gzip 1
$ gzip 2
$ cat 1.gz 2.gz >3.gz
$ zcat 3.gz
aaabbb

And lumberjack compresses each log backups only, no merging performed here, leaving the gzip backups deleted before they reach the space limit.

image

And this is my config, which specify 128M size limit, but gzip backups only reach to 18M or so : (

image

Will you guys consider this is a feature Todo?

phuslu commented 3 years ago

If lumberjack has a "Cleaner" or "OnRollover" callback, it will be easy.

I implemented on my own filewriter, https://github.com/phuslu/log/blob/master/file.go#L191-L212 Note: the w.Cleaner callback awares gz files and their size, so you could decide what you will do.

sequix commented 3 years ago

If lumberjack has a "Cleaner" or "OnRollover" callback, it will be easy.

I implemented on my own filewriter, https://github.com/phuslu/log/blob/master/file.go#L191-L212 Note: the w.Cleaner callback awares gz files and their size, so you could decide what you will do.

Great logger you did, I will use the filewriter you wrote : )

sequix commented 3 years ago

just finished the rotater based on @phuslu's job:

https://github.com/sequix/sup/blob/main/pkg/rotate/rotate.go

phuslu commented 3 years ago

nice and congrats, i believe my file writer implementation is easy modified and simple enough to math with v3 Work Thread point 5