-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Hi folks,
I have the following problem. The information which will be logged into the remote_client_id field in kibana are either a uuid or an info_user_id.
morgan.token("remote_client_id", function getRemoteClientId(
request,
response
) {
let rcId = "";
try {
rcId = request.headers.customeruuid;
if (request.headers[CUSTOMER_UUID]) {
rcId = request.headers[CUSTOMER_UUID];
}
if (request.headers[AUTH_INFO_USER_ID]) {
rcId = request.headers[AUTH_INFO_USER_ID];
}
if (request.headers[AUTH_REMOTE_CLIENT_ID]) {
rcId = request.headers[AUTH_REMOTE_CLIENT_ID];
}
if (!rcId) {
rcId = "unknown";
}
} catch (e) {
rcId = "error";
}
return rcId;
});
Both of this informations are a little bit miss leading, since both are not the real client Id.
I want to write the real client Id (from an oauth token in my case) into this log field.
Unfortunately I cannot use these header attributes and just fill it with another information because other services reliant on the right UUID and an info_user_id.
So the only way to solve that problem I can imagine is to ad another if-clause and extend the logic in the method above with a new header attribute. Something like this:
if (request.headers[AUTH_REMOTE_CLIENT_ID])
{
rcId = request.headers[AUTH_REMOTE_CLIENT_ID];
}
Is this an option for you?
Metadata
Metadata
Assignees
Labels
No labels