Add access token information to API log
What does this MR do and why?
This MR will add information about the used access token to the API log.
Screenshots or screen recordings
These are strongly recommended to assist reviewers and reduce the time to merge your change.
How to set up and validate locally
- Create an access token at http://localhost:3000/-/profile/personal_access_tokens
- Use the created access token to access the api:
curl http://localhost:3000/api/v4/user -H "private-token: <token>"
- Observe the token information in
gitlab/log/api_json.log
:
{
"time": "2022-07-16T17:34:23.235Z",
"severity": "INFO",
"duration_s": 0.15425,
"db_duration_s": 0.02159,
"view_duration_s": 0.13266,
"status": 200,
"method": "GET",
"path": "/api/v4/user",
"params": [],
"host": "localhost",
"remote_ip": "127.0.0.1",
"ua": "curl/7.84.0",
"route": "/api/:version/user",
"user_id": 103,
"username": "project_8_bot",
"token_type": "PersonalAccessToken",
"token_id": 9,
...
}
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Joern Schneeweisz