nodejs-logging-bunyan
nodejs-logging-bunyan copied to clipboard
Attaching labels to Http Request logs middleware
Hello!
We have been using this library since more than one year, by making use of the middleware for request bundling and metadata. Recently we decided to improve our logging capabilities by attaching some extra label on any request log to better filter our log due to the increasing complexity of our product.
If we want to filter by a specific client session, we just send an additional header to the request and we include that header on the labels we attach to the logs.
The problem is that we have not been able to attach the same labels to the log of the Http request, thus severely limiting the usefulness of the labels in this use case.
A possible workaround would be to print an extra log that would be redundant with the main request log, but we will lose most of the benefit of having the request bundled and the extra formatting we get by using the middleware.
As you can see in the filter, if I would like to filter the logs by the green label, I wouldn't be able to see the log of the requests.