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
The problem I am facing
When using a custom Logger.log function, all you get passed to you is the message as a string. It'd be nice if you were also passed as much information about the current socket/request as possible, so that you could log the client IP address, user agent, and other information common in more traditional HTTP logs.
The solution I would like
Since changing the signature of LoggerConfiguration.log would probably break backwards compatibility, maybe either:
A new LoggerConfiguration property like logFormat, which has more parameters including request/socket information and returns a string. Beyond adding request information, this seems generically useful for doing something like structured logging (JSON instead of having the timestamp in the log message) as well.
More request/socket information passed to hooks - I tried adding logging in onAuthenticate but was not able to determine the request/socket IP address from onAuthenticatePayload.
Alternatives I have considered
Making my own Logger extension, which would be OK but I'm not sure how to get the client IP address in hooks like onAuthenticatePayload.
Additional context
At a high level I'm trying to add enough logging to the hocuspocus to make debugging security incidents feasible, which at a minimum would need the IP address of the current connection (for log messages where that is relevant).
The text was updated successfully, but these errors were encountered:
Note that if hocuspocus is behind a proxy, requestHeaders is probably sufficient (although you'll still need a completely custom logger, so the logFormat idea I think is still OK).
The problem I am facing
When using a custom Logger.log function, all you get passed to you is the message as a string. It'd be nice if you were also passed as much information about the current socket/request as possible, so that you could log the client IP address, user agent, and other information common in more traditional HTTP logs.
The solution I would like
Since changing the signature of
LoggerConfiguration.log
would probably break backwards compatibility, maybe either:LoggerConfiguration
property likelogFormat
, which has more parameters including request/socket information and returns a string. Beyond adding request information, this seems generically useful for doing something like structured logging (JSON instead of having the timestamp in the log message) as well.onAuthenticate
but was not able to determine the request/socket IP address fromonAuthenticatePayload
.Alternatives I have considered
Making my own Logger extension, which would be OK but I'm not sure how to get the client IP address in hooks like
onAuthenticatePayload
.Additional context
At a high level I'm trying to add enough logging to the hocuspocus to make debugging security incidents feasible, which at a minimum would need the IP address of the current connection (for log messages where that is relevant).
The text was updated successfully, but these errors were encountered: