Feature #15863
Log request IDs (tagged logging) in production.log
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.
Related issues
Associated revisions
History
#1
Updated by The Foreman Bot about 6 years ago
- Status changed from Assigned to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/3678 added
#2
Updated by Dominic Cleal about 6 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset d97deb49dc07939998565bec0cef582082a8d91d.
#3
Updated by Lukas Zapletal about 6 years ago
- Related to Feature #15876: Send request and session ids to foreman-proxy as HTTP headers added
#4
Updated by Dominic Cleal about 6 years ago
- Related to Feature #10982: Add logging to smart proxy requests (ProxyAPI) added
#5
Updated by Dominic Cleal about 6 years ago
- Legacy Backlogs Release (now unused) set to 160
#6
Updated by Ivan Necas over 5 years ago
- Bugzilla link set to 1435563
#7
Updated by Ivan Necas over 5 years ago
- Related to Bug #19017: Use request id instead of session id of tagged logging added
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.