You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like url attribute is being set with information from req instead of ecs like the rest of the attributes. This is causing full to reflect a different address than domain in our environment. Would this be more appropriate?
@benvmatheson Thank you for this issue. My apologies for having take such a ridiculously long time to reply. I imagine you have moved on, but in the off chance that this is still relevant to you, I'd like to discuss it. I understand if you don't respond.
The formatHttpRequest() function is effectively (a) setting url.full using the hostname from req.headers.host and (b) setting url.domain from req.hostname. Looking at this code again, this code could be documented much better.
Express's req.hostname is from the Host header -- or from the X-Forwarded-Host header depending on configuration. Could this be what you are/were seeing? Are you able to show some data from an example?
(Aside: There is a similar issue -- #53 -- about the value used for setting the client.ip field from either core Node.js req.socket.remoteAddress or from Express's req.ip (https://expressjs.com/en/4x/api.html#req.ip), which considers an X-Forwarded-For header.)
Or I might be misunderstanding you. You suggest using ecs.headers.host. Is your logging statement explicitly setting headers.host to some value that differs from the req.headers.host?
ecs-logging-nodejs/helpers/lib/http-formatters.js
Line 59 in 26aaa6a
It looks like
url
attribute is being set with information fromreq
instead ofecs
like the rest of the attributes. This is causingfull
to reflect a different address thandomain
in our environment. Would this be more appropriate?ecs.url.full = (socket && socket.encrypted ? 'https://' : 'http://') + ecs.headers.host + ecs.url.path
The text was updated successfully, but these errors were encountered: