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

Error : Digest method not supported while using winston.transports.DailyRotate #340

Closed
patilms16 opened this issue Mar 21, 2022 · 11 comments

Comments

@patilms16
Copy link
Contributor

patilms16 commented Mar 21, 2022

Environment :

OS : SUSE Linux Enterprise Server 15 SP2
Node: 14.16.0
Express: 4.17.1,
winston: 3.2.1,
winston-daily-rotate-file: 4.4.2

I am using following code :

 var transport = new (winston.transports.DailyRotateFile)({
        filename: 'log/server-%DATE%.log',
        datePattern: 'YYYY-MM-DD-HH',
        maxSize: '100m', //100MB
        zippedArchive: true,
        maxFiles: '10',
        frequency: '24h'
    });

and getting error from crypto submodule of nodejs as "Digest method not supported"

Below is actual line which was throwing error from File "FileStreamRotator.js" under node_modules :
crypto.createHash('md5').update(logfile + "LOG_FILE" + time).digest("hex")

Can someone please help to identify the issue here and probable solution?

stack-overflow : https://stackoverflow.com/questions/71552510/error-digest-method-not-supported-while-using-winston-transports-dailyrotate

@wbt
Copy link
Collaborator

wbt commented Mar 21, 2022

From createHash docs:

On recent releases of OpenSSL, openssl list -digest-algorithms (openssl list-message-digest-algorithms for older versions of OpenSSL) will display the available digest algorithms.

Can you please run that command on your platform and see if md5 is in the list?

@patilms16
Copy link
Contributor Author

patilms16 commented Mar 21, 2022

md5 is not in the list on SLES platform where I am getting error.
However I have checked the algorithm list on the platform (HELIOS 7.7 ) on which method is working fine without any error ( Interestingly md5 is not shown in the list on this platform as well.
Please check openssl version and algorithm list for both platforms in below screenshot ( Please note : for Helios platform it is not throwing any error but for SLES platform it does )

image

@wbt
Copy link
Collaborator

wbt commented Mar 22, 2022

This looks like a system configuration issue rather than necessarily a bug in Winston. There may be some setting on your system that disabled md5 hashing as it's a pretty weak hash.
I'm generally in favor of moving past md5 because it's relatively easy to find hash collisions, but would want analysis on the potential for breaking existing workflows which might assume the current algorithm.
In any event, the code you are identifying as problematic isn't in this package (Winston) but rather a dependency, so you might find more knowledgeable input about that in the repo where it's built.

Please note that when posting related questions in multiple places, it is best practice to include cross-links so that those coming after you who might encounter a similar issue can connect through to one where there might've been some progress; I would have expected to see cross links between this and your Stack Overflow question as well as with any new question you might open in file-stream-rotator. Splitting the questions without cross-links and filing on the wrong repo makes open-source work harder than it otherwise should be; please be more considerate of this next time.

@wbt wbt closed this as completed Mar 22, 2022
@patilms16
Copy link
Contributor Author

patilms16 commented Mar 22, 2022

Thanks a lot @wbt for providing the information.
I have updated the cross-links and will make sure to follow this in future!!

Also posted the question in FileStreamRotator repo to get more information: rogerc/file-stream-rotator#90

Question posted in stack-overflow : https://stackoverflow.com/questions/71552510/error-digest-method-not-supported-while-using-winston-transports-dailyrotate

@patilms16
Copy link
Contributor Author

patilms16 commented Apr 7, 2022

@wbt
In order to resolve this issue, need an update in daily-rotate-file.js to include option audit_hash_type

watch_log: options.watchLog ? options.watchLog : false

Please check : rogerc/file-stream-rotator#90

@wbt wbt reopened this Apr 7, 2022
@wbt
Copy link
Collaborator

wbt commented Apr 7, 2022

Open to PRs.

@patilms16
Copy link
Contributor Author

Created pull request : #344
Please review and let me know in case any issues.

@patilms16
Copy link
Contributor Author

@wbt Could you please verify and merge this request? We have 1 critical issue need to be fixed immediately.

@ajayparsana
Copy link

ajayparsana commented Apr 26, 2022

Thanks @patilms16 for the fix. We recently upgraded our system and facing the similar issue.

@mattberther @indexzero Can you please help with Merging request 344. This will unblock us and allow us to continue using winston daily rotate.

Appreciate your help.

@ajayparsana
Copy link

@wbt Thanks for the merge. @mattberther Can you please publish this to npm

@mattberther
Copy link
Member

Pushed as [email protected].

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

No branches or pull requests

4 participants