mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
errno is not set for ECONNRESET
29d8f4b5ea/lib/index.js (L290)
Closes https://github.com/elastic/kibana/issues/22225
Example:
{ Error: socket hang up
at TLSSocket.onSocketClose (_tls_wrap.js:761:23)
at TLSSocket.emit (events.js:194:15)
at _handle.close (net.js:600:12)
at Socket.done (_tls_wrap.js:388:7)
at Object.onceWrapper (events.js:277:13)
at Socket.emit (events.js:189:13)
at TCP._handle.close (net.js:600:12) code: 'ECONNRESET'
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
This commit is contained in:
parent
010d8db324
commit
1275d01098
2 changed files with 8 additions and 6 deletions
|
@ -32,11 +32,13 @@ function doesMessageMatch(errorMessage, match) {
|
|||
if (isRegExp) return match.test(errorMessage);
|
||||
return errorMessage === match;
|
||||
}
|
||||
// converts the given event into a debug log if it's an error of the given type
|
||||
function downgradeIfErrorType(errorType, event, field = 'errno') {
|
||||
const isClientError = doTagsMatch(event, ['connection', 'client', 'error']);
|
||||
const matchesErrorType = isClientError && get(event, `error.${field}`) === errorType;
|
||||
|
||||
// converts the given event into a debug log if it's an error of the given type
|
||||
function downgradeIfErrorType(errorType, event) {
|
||||
const isClientError = doTagsMatch(event, ['connection', 'client', 'error']);
|
||||
if (!isClientError) return null;
|
||||
|
||||
const matchesErrorType = get(event, 'error.code') === errorType || get(event, 'error.errno') === errorType;
|
||||
if (!matchesErrorType) return null;
|
||||
|
||||
const errorTypeTag = errorType.toLowerCase();
|
||||
|
@ -117,7 +119,7 @@ export class LogInterceptor extends Stream.Transform {
|
|||
}
|
||||
|
||||
downgradeIfHTTPSWhenHTTP(event) {
|
||||
return downgradeIfErrorType('HPE_INVALID_METHOD', event, 'code');
|
||||
return downgradeIfErrorType('HPE_INVALID_METHOD', event);
|
||||
}
|
||||
|
||||
downgradeIfHTTPWhenHTTPS(event) {
|
||||
|
|
|
@ -31,7 +31,7 @@ function stubClientErrorEvent(errorMeta) {
|
|||
};
|
||||
}
|
||||
|
||||
const stubEconnresetEvent = () => stubClientErrorEvent({ errno: 'ECONNRESET' });
|
||||
const stubEconnresetEvent = () => stubClientErrorEvent({ code: 'ECONNRESET' });
|
||||
const stubEpipeEvent = () => stubClientErrorEvent({ errno: 'EPIPE' });
|
||||
const stubEcanceledEvent = () => stubClientErrorEvent({ errno: 'ECANCELED' });
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue