Skip to content

Enrich log records with request context parameters - #641

Open
phavekes wants to merge 3 commits into
mainfrom
feature/log-request-context
Open

phavekes wants to merge 3 commits into
mainfrom
feature/log-request-context

Conversation

@phavekes

@phavekes phavekes commented Oct 7, 2026

Copy link
Copy Markdown
Member

Description

Adds RequestContextProcessor Monolog processor to extract request context parameters (identity_id, collab_person_id, second_factor_id, recovery_token_id, name_id, institution) from route attributes, query parameters, POST request bodies, and JSON command payloads, and append them to log records under extra.

Example Log Entries

1. Identity authorization check (GET path parameter)

Request: GET /authorization/may-self-vet-using-self-asserted-token/f9913e4b-8f50-4729-97b9-87ca9b33f0b8

{
  "message": "Checking self-asserted token authorization",
  "context": {},
  "level": 200,
  "level_name": "INFO",
  "channel": "app",
  "datetime": "2026-10-07T09:19:55+00:00",
  "extra": {
    "request_id": "29e025623a3a1029ddbd5db71d1c064a",
    "application": "middleware",
    "server": "mw-dev.stepup.coin.surf.net",
    "identity_id": "f9913e4b-8f50-4729-97b9-87ca9b33f0b8"
  }
}

2. Deprovisioning (DELETE path parameter)

Request: DELETE /deprovision/urn:collab:person:surfnet.nl:jdoe

{
  "message": "Deprovision request processed",
  "context": {},
  "level": 200,
  "level_name": "INFO",
  "channel": "app",
  "datetime": "2026-10-07T09:19:55+00:00",
  "extra": {
    "request_id": "29e025623a3a1029ddbd5db71d1c064a",
    "application": "middleware",
    "server": "mw-dev.stepup.coin.surf.net",
    "collab_person_id": "urn:collab:person:surfnet.nl:jdoe"
  }
}

3. RA listing (Path parameters for Identity and Institution)

Request: GET /ra-listing/f9913e4b-8f50-4729-97b9-87ca9b33f0b8/surfnet

{
  "message": "Retrieving RA listing",
  "context": {},
  "level": 200,
  "level_name": "INFO",
  "channel": "app",
  "datetime": "2026-10-07T09:19:55+00:00",
  "extra": {
    "request_id": "29e025623a3a1029ddbd5db71d1c064a",
    "application": "middleware",
    "server": "mw-dev.stepup.coin.surf.net",
    "identity_id": "f9913e4b-8f50-4729-97b9-87ca9b33f0b8",
    "institution": "surfnet"
  }
}

4. Command execution (POST JSON payload)

Request: POST /command with JSON payload containing id, name_id, institution

{
  "message": "Command received and handled",
  "context": {},
  "level": 200,
  "level_name": "INFO",
  "channel": "app",
  "datetime": "2026-10-07T09:19:55+00:00",
  "extra": {
    "request_id": "29e025623a3a1029ddbd5db71d1c064a",
    "application": "middleware",
    "server": "mw-dev.stepup.coin.surf.net",
    "identity_id": "abb1b9f8-20c9-44a9-9694-176f00aaa618",
    "name_id": "29c41b84214b4fd5fb4d508e680fc921",
    "institution": "Example Org"
  }
}

@phavekes
phavekes requested a review from kayjoosten October 9, 2026 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant