ecs-logging-nodejs
ecs-logging-nodejs copied to clipboard
Node.js formatters for Elastic Common Schema (ECS) logging
Currently `formatHttpRequest` and `formatHttpResponse` handle server-side request and response objects (from node core and some of the http frameworks). It would be nice to support the *client-side* request and response...
Hello guys: After jump from previous version (0.1...0.2) to 1.0 i found that my REQ object isn't logged anymore... Digger into the code, i found that the expected shape of...
ECS 1.9.0 formalizes http.request.id: https://github.com/elastic/ecs/releases/tag/v1.9.0 Currently `formatHttpRequest` will map `req.id` to `event.id`. That isn't documented or in the tests. Judgement call if that mandates a breaking change to remove.
Now that formatError, formatHttpRequest, and formatHttpResponse return a bool for whether they processed the field, the loggers should use that to pass through *un*processed fields on the log record. Currently...
Currently `formatError` in the helpers package does this: ```js function formatError (ecsFields, err) { if (!(err instanceof Error)) { ecsFields.err = err //
When ECS 1.9 comes out it will have a `http.request.id` field (https://github.com/elastic/ecs/pull/1208) which some of the logging libs in this repo will want to consider.
Currently `helpers.formatHttpRequest` mainly uses `req.socket.remoteAddress` for the "client.ip" ECS field. It could consider using some of the HTTP request headers (esp. X-Forwarded-For) to set this. If using Express, then `req.ip`...
Currently `formatHttpRequest` is manually doing URL parsing. I think using the standard `url.URL` for parsing would fix potential issues with weird URLs. Also, in the case of a hapi request...
Hello everybody I'm having trouble getting the http.request.id to log in correctly. Looking at the lib [@elastic/ecs-winston-format ](https://github.com/elastic/ecs-logging-nodejs/tree/main/loggers/winston) and [@elastic/ecs-helpers ](https://github.com/elastic/ecs-logging-nodejs/tree/main/helpers), I couldn't find any parse of the [X-Request-ID](https://www.elastic.co/guide/en/ecs/8.4/ecs-http.html#field-http-request-id) or...
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...