How to access generated request ID in request or response object? #4813
-
In Fastify logging, you can provide a custom function to genReqId that generates the IDs. I want to be able to access this value via the request/response object and return it along with the response body. Is this possible? The reason is that, I want the request log to be easily searchable when the users report an issue. |
Beta Was this translation helpful? Give feedback.
Answered by
Uzlopak
Jun 11, 2023
Replies: 1 comment 1 reply
-
Theoretically you could add a hook in onSend and take the id from request.id and put it into e.g. response.header['x-request-id'] |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
SiNONiMiTY
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Theoretically you could add a hook in onSend and take the id from request.id and put it into e.g. response.header['x-request-id']