ecs-logging-nodejs icon indicating copy to clipboard operation
ecs-logging-nodejs copied to clipboard

Winston error handling is incompatible with ecs-winston-format error handling

Open sveneh opened this issue 3 years ago • 0 comments

Winston allows error to be passed directly to a log message https://github.com/winstonjs/logform#errors, like winston.error(new Error()), while ecs-winston-format requires errors to be added to the ecs-specific err field, like winston.errror({ err : new Error() })

This has two side effects. The minor one is that one must refactor its own code to match the ecs guidelines. The more annoying side effect is that this will not work with Winston's special Exception https://github.com/winstonjs/winston#exceptions and Rejection https://github.com/winstonjs/winston#handling-uncaught-promise-rejections-with-winston handlers These handlers will log errors via Winston's default error handling and cannot be refactored to use the special ecs handling. As such, those errors don't show up correctly in Elasticsearch, making them harder to detect.

Please make ecs-winston-format compatible with default winston error handling.

sveneh avatar Sep 21 '22 12:09 sveneh