winston-elasticsearch icon indicating copy to clipboard operation
winston-elasticsearch copied to clipboard

Detect and log failed credentials

Open tvedtorama opened this issue 5 years ago • 4 comments

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?

tvedtorama avatar Feb 17 '20 09:02 tvedtorama

have you tried to listen to the error event via .on('error', ...) ?

vanthome avatar Apr 07 '20 20:04 vanthome

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.

tvedtorama avatar Apr 08 '20 04:04 tvedtorama

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)

Munawwar avatar Jun 09 '20 09:06 Munawwar

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

TomChv avatar Nov 03 '20 17:11 TomChv