Rcomian / bunyan-rotating-file-stream

Is an endpoint for bunyan that lets you control how much disk space logs take.
Other
29 stars 15 forks source link

Rotating gz files #4

Closed i3fox closed 8 years ago

i3fox commented 8 years ago

Hi,

I see a note in "Deleting old files" section: ... (excluding the .gz if you are compressing old files)

Why totalFiles do not work when is present gzip option? There is an option to enable this?

Thanks

Rcomian commented 8 years ago

I think it might just be bad wording. You can use totalFiles and gzip options together.

That section is trying to describe what files are considered when deleting things. It does consider the .gz files, it just ignores the .gz when doing the match.

i3fox commented 8 years ago

For me it is interesting to have delete also with gz file extension.

I need to keep a historical deep a week but for the size I zip logger.

Rcomian commented 8 years ago

As I say, it should work.

Have you tried this and found it doesn't work?

i3fox commented 8 years ago

I tried but doesn't work.

totalFiles: 7, gzip: true, period: 1d

In the log directory I found nine gz files and not only seven files.

datalog.2016-04-17.log.gz datalog.2016-04-18.log.gz datalog.2016-04-19.log.gz datalog.2016-04-20.log.gz datalog.2016-04-21.log.gz datalog.2016-04-22.log.gz datalog.2016-04-23.log.gz datalog.2016-04-24.log.gz datalog.2016-04-25.log.gz datalog.2016-04-26.log

Rcomian commented 8 years ago

Aha!

Thank you, I'll look at this tonight.

Rcomian commented 8 years ago

Oh that's interesting. If you change your pathname to: 'datalog-%Y-%m-%d.log' it will work.

You'll need to rename or move the existing log files.

Using a dot '.' after datalog is confusing the filename parser somehow. I'll work on a fix for this.

i3fox commented 8 years ago

I tried and it will work.

Thanks for your speed to fix a problem.