Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zip archives if zippedArchive is true #1741

Closed
wants to merge 5 commits into from

Conversation

pixtron
Copy link
Contributor

@pixtron pixtron commented Dec 3, 2019

As reported in #1128 since v3 the archives are not zipped anymore. They just get the ".gz" file extension.

As @glemco correctly pointed out the gzip stream never get's any data piped into as the log data is directly piped from the passthrough stream to the file:

source.pipe(dest);

The docs say:

zippedArchive: If true, all log files but the current one will be zipped.

Therefore the data should not be zipped while logging, but when the files are rotated.

The PR contains the following changes and resolves #1128

* Zip archives during rotation if zippedArchive is true
* Remove gzip stream which was never written to
  (see winstonjs#1128 (comment))
* ads tests checking the contents of zipped archives
* ads tests for rolling files with tailable: false
* Fixes previously failing test tests/tail.file.test.js
@pixtron
Copy link
Contributor Author

pixtron commented Dec 3, 2019

Tests are running without any errors on local windows with node v8, v10 and v12. Not sure why the test for the last two commit failed on appveyor, but Error: Cannot find module 'C:\projects\winston\node' seems to be a temporary error while starting mocha.

For the first three commits the EPERM was most likely thrown because of nodejs/node/issues/4760. On Windows fs.readdir called shortly after unlinking a file, might report the unlinked file still present until all handles are closed. In this case a call to fs.unlink or fs.lstat on that file errors with EPERM as long as the file is in the transient state of being unlinked.

@bartenew
Copy link

Can this be merged?

@kingnebby
Copy link

👍

4 similar comments
@hfritts
Copy link

hfritts commented Sep 25, 2020

👍

@n8dickinson
Copy link

👍🏼

@jtackett-collinear
Copy link

👍

@eric-gonzalez-tfs
Copy link

👍🏽

@DABH
Copy link
Contributor

DABH commented Jan 3, 2024

Closing this in favor of #2337, which is essentially the same but no conflicts. Thank you for this contribution (which is mainly incorporated in the other PR -- want to make sure you're getting credit). But I think we can go ahead and try to merge this other PR and see if people are happy with it.

@DABH DABH closed this Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Winston Transport File - zippedArchive option doesn't work correctly
9 participants