winston-elasticsearch
winston-elasticsearch copied to clipboard
Detect and log failed credentials
When I use wrong credentials for Elastic, the checkEsConnection
function will retry the check forever. This does not give a clue that the logging is not active due to invalid credentials, which could give a false sense of allrightness.
Exit the retryloop and log when the server returns 401?
have you tried to listen to the error event via .on('error', ...)
?
Yes, but I don't think the failed credentials issue end up there - it just keeps trying, as if the Es server is temporarily down.
If there was a way to detect intermittent errors vs permanent errors I could implement this
I guess here are some ideas to filter them for retry:
- TimeoutError, ConnectionError
- 408 request timeout
- 429 too many requests
- 5xx http status codes (mostly 500,502,503,504)
Not sure about "No living connection" error (means probably no ES is running)
Hi @vanthome, can you publish the last version of the lib on npm ? I would like to use the library with my previous MR that fix this bug