Actions
Feature #15863
closedLog request IDs (tagged logging) in production.log
Difficulty:
Triaged:
Bugzilla link:
Pull request:
Description
Request IDs can be added to Foreman's logs to make it easier to trace all log messages relating to a particular request when they interleave from multiple server processes.
Rails stores an ID in the request environment by default, and since Rails 5, the default configuration is to log it. The request ID is derived from the X-Request-ID header, otherwise a random UUID. Since Foreman uses the logging gem without tagging support instead of the default Rails logger, implementing this requires passing the extra information to its MDC/NDC (context) storage.
Added by Dominic Cleal over 8 years ago
Actions
fixes #15863 - add short session or request ID to logs
New middleware stores the session and request IDs (either from
X-Request-ID or a UUID generated by Rails) in the logger's thread
storage. The truncated session ID is now logged by default to minimise
size of the log messages.