Extend shell logs with additional metadata
Contributes to https://gitlab.com/gitlab-org/gitlab/-/issues/455046
Rails MR: Expose project/namespace IDs in `internal/allow... (gitlab!148525 - merged)
Problem
We discovered that reliance on project and namespace paths is not sufficient. User can rename the group or project and that might lead to problems with identifying the correct project/namespace.
Solution
Add of project/namespace IDs to the application logs.
Before
{
"correlation_id": "01HVNJS21YGFGPNX3TJWK82ZGH",
"duration_s": 7.739879709,
"level": "info",
"meta": {
"project": "twitter/issue-450749",
"root_namespace": "twitter"
},
"msg": "access: finish",
"remote_addr": "127.0.0.1:53052",
"time": "2024-04-17T08:29:15Z",
"written_bytes": 7302
}
After
{
"correlation_id": "01HVNJTXE678VZYV2NRNX1X65S",
"duration_s": 9.028768333,
"level": "info",
"meta": {
"project": "twitter/issue-450749",
"root_namespace": "twitter",
"project_id": 242, # <- new
"root_namespace_id": 35 # <- new
},
"msg": "access: finish",
"remote_addr": "127.0.0.1:53407",
"time": "2024-04-17T08:30:17Z",
"written_bytes": 7317
}
Edited by Vasilii Iakliushin