-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Winston Transport File - zippedArchive option doesn't work correctly #1128
Comments
I have the exact same issue with 3.0.0-rc4. and even the zipped file is useless, it is not appended when you log, and I cannot read it with gzcat. |
I have the same issue with 3.0.0. new winston.transports.File({
level: 'info',
filename: LOGS_PATH,
handleExceptions: true,
maxsize: MAX_LOG_SIZE,
timestamp: true,
maxFiles: 5,
eol: '\r\n',
prettyPrint: true,
zippedArchive: true
}) This results in the latest file being gzipped. In 2.4.2, all but the latest file were zipped. |
In my case the logfiles are not zipped at all, although λ file somelog.log.gz
somelog.log.gz: ASCII text Gzipped would look like: λ gzip package.json
λ file package.json.gz
package.json.gz: gzip compressed data, was "package.json", last modified: Thu Aug 23 16:41:38 2018, from Unix, original size 2354 |
I use this package in all my projects: https://github.com/paolotremadio/homeautomation-winston-logger All the files emitted are .gz but they are still in plain text (so they are not actually compressed). Can someone tell me what I'm doing wrong? |
i have same issue, only ".gz" appends to the filename and not correctly gzipped. |
can anyone help us? |
@masoudltf: it's odd, it should zip all the logs (even if the first one should be not zipped). |
@KingRial
|
@paolotremadio : |
@masoudltf: you are right, the latest winston (3.1.0) doesn't zip any file but only adds the .gz extension. |
bug report needed? |
Sorry this issue went unattended. Looking at https://github.com/winstonjs/winston/blob/master/lib/winston/transports/file.js#L543 it looks like the File transport returns either a gzip stream or a regular stream. So if zippedArchive is true then your log should be getting zipped. There is also some code https://github.com/winstonjs/winston/blob/master/lib/winston/transports/file.js#L663 that looks related to adding .gz extensions to old files when rotation happens. But indeed I don't see something that indicates all but the latest log will be zipped -- looks more like all or none get zipped depending on zippedArchive. Also, there is no method to inflate logs, that would presumably be the user's job if they cared to view those logs later. If you can reproduce issues using |
What it seems is happening [in |
@DABH |
Is anyone working on a patch? Othwrwise I can give it a try |
I tried by just using the gzip stream, but it was giving me problems on the most recent log (the one that's currently written to, with tailable option). It was taking too much time so we rather decided to stay on 2.x . If you can make a pull request fixing it, that would be great |
+1 winston version 3.2.1 |
Any update on this? Anyone knows an older version that it works? |
2.4.4 does zip the rotated files. |
In our case, gzip functionality was crucial, so we decided to migrate our logging to https://log4js-node.github.io/log4js-node/ and everything worked flawlessly |
* 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
Still happening on 3.3.3 😔 |
The problem persists in version 3.8.1. |
still persist in 3.8.2 |
Hi @DABH , I would like to give it a try. Please assign it to me. |
Done — thank you so much for being willing to take this on!! |
Hey @DABH , can you specify what is the expeected ideal behaviour for zipped archive option? Also was there a previous version, when it was working as expected? |
Hi @DABH , I have a question that when should the log file be zipped? Is it after the file size is equal to maxsize and new file is created. If yes, in that case, we will start logging initially with no zip files? |
Is there a workaround for this? the logger only rename the extension of the file to .gz Im using v3.10 |
@Pulkit0729 Yeah I think you rotate when the uncompressed file size reaches the max size, and then you compress the log file that you just finished writing to. And initially you would have no zip files. But if you have file rotation on, then with zipping set to true, you would end up with multiple zip files |
@Pulkit0729 I think the last time this worked was probably Winston 2.x, it’s one of the features we sadly didn’t have test cases for and wasn’t carefully accounted for or tested when writing 3.x |
Closed via #2337 |
If you use the following transport file:
The resulting "test.log" is zipped.
This is wrong since the documentation tells that:
The text was updated successfully, but these errors were encountered: