Closed roydondsouza closed 6 years ago
@indexzero, @FotoVerite, @Marak can you help me out here?
Hi, Anyone has implemented this for finding differentiate/ unique identifier logs of each user.?
@ne00346536 we can add unique identifiers using middleware in php Monolog by doing something like this
Looking for a similar functionality here, I was not able to locate it in the documentation.
This can be accomplished with using custom formats in winston@3.0.0
. Please consider upgrading.
Specifically you would define a format to set a uid
on each info
object and then plumb through that uid
for all other services your logs might end up at.
@indexzero I wanted to clarify your comment. I added this custom format
const requestId = format((info, opts) => {
if (opts.requestId) {
info.uid = opts.requestId;
}
return info;
});
What do you mean by this statement, can you provide an example?
then plumb through that uid for all other services your logs might end up at.
Feature request: Can we add unique identifier for logs using formatters/processors? This would be a good addition Kindly point me to the relevant documentation if this feature is already present.
Objective: Is to identify a log set of one full flow of request, helps us query all logs for a session of each user of each API endpoint.
Example:
All Logs:
Query uid 6sdf867:
Query uid 3298080:
Reference: I have used this feature in a PHP logger - Monolog ... using processors using the UidProcessor