Project

General

Profile

Feature #15863

Log request IDs (tagged logging) in production.log

Added by Dominic Cleal about 4 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Logging
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

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

Related to Foreman - Feature #15876: Send request and session ids to foreman-proxy as HTTP headersDuplicate2016-07-28
Related to Foreman - Feature #10982: Add logging to smart proxy requests (ProxyAPI)Closed2015-07-02
Related to Foreman - Bug #19017: Use request id instead of session id of tagged loggingClosed2017-03-24

Associated revisions

Revision d97deb49 (diff)
Added by Dominic Cleal about 4 years ago

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.

History

#1 Updated by The Foreman Bot about 4 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 4 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#3 Updated by Lukas Zapletal about 4 years ago

  • Related to Feature #15876: Send request and session ids to foreman-proxy as HTTP headers added

#4 Updated by Dominic Cleal about 4 years ago

  • Related to Feature #10982: Add logging to smart proxy requests (ProxyAPI) added

#5 Updated by Dominic Cleal about 4 years ago

  • Legacy Backlogs Release (now unused) set to 160

#6 Updated by Ivan Necas over 3 years ago

  • Bugzilla link set to 1435563

#7 Updated by Ivan Necas over 3 years ago

  • Related to Bug #19017: Use request id instead of session id of tagged logging added

Also available in: Atom PDF