Log request_id for each api call
Blueprint [1] was implemented in the last Mitaka release cycle which returns request_id back to the caller as per design proposed in the cross-project specs [2]. Now, in step 2, we would like to log x-openstack-
Following log message will be logged in debug logging level.
LOG.debug(
"used request_id '%(response_
{"method": resp.request.
"my_
"my_url": resp.url, "response_
method: HTTP request method (GET/POST/
my_service_name: Name of service processing the request (cinder or
my_url: Request URL with endpoint
response_
The log messages logged by the log handlers would be dependant on how the root loggers are configured.
1. python-cinderclient used as a shell command:
In this case, the root loggers will be configured in the client itself. So if --debug flag is passed in the command, then following log message will be shown on console:-
DEBUG:keystonec
http://
used request id req-9dd9ffc4-
Nothing will be logged on console if --debug flag is not set.
Note:
By default python-cinderclient uses keystone session to create object of SessionClient and 'ks_logger' configured in cinderclient/
2. python-cinderclient is used in applications (e.g. Nova)
In this case, when Nova calls apis of Cinder service using python-
DEBUG cinderclient.
demo demo] GET call to 'cinder' for http://
9ffea7c24c9d440
used request_id 'req-33821d15-
In the above log message, you will see both nova (callee) and cinder (caller) request_ids are logged in the same log message. This is because, the root loggers are configured in Nova and the same will be used by the client as well. Since nova uses oslo.log library, it internally logs request_id using ContextFormatter configured in the "formatter_context" section of the nova configuration file.
References:
[1] https:/
[2] http://
Mailing List discussion:
http://
Blueprint information
- Status:
- Not started
- Approver:
- Sean McGinnis
- Priority:
- Low
- Drafter:
- Abhishek Kekane
- Direction:
- Approved
- Assignee:
- Abhishek Kekane
- Definition:
- Approved
- Series goal:
- Accepted for newton
- Implementation:
- Unknown
- Milestone target:
- None
- Started by
- Completed by
Related branches
Related bugs
Sprints
Whiteboard
Gerrit topic: https:/
Addressed by: https:/
Log request-id for each api call