Skip to content

Health#862

Open
Nanafancy wants to merge 2 commits into
DistinctCodes:mainfrom
Nanafancy:health
Open

Health#862
Nanafancy wants to merge 2 commits into
DistinctCodes:mainfrom
Nanafancy:health

Conversation

@Nanafancy
Copy link
Copy Markdown

[BE-31] Add structured request logging middleware with correlation IDs in opsce module

Problem
The backend has no request logging. When errors occur in production, there is no way to trace a request through the system or correlate incoming requests with outgoing responses in logs.

Proposed Solution
Create backend/src/opsce/common/middleware/logger.middleware.ts. Generate a UUID correlationId per request, attach it to request and response headers, and log structured JSON per request/response.

Acceptance Criteria
Each request gets a X-Correlation-Id UUID header (generated if not provided by the client)
Logs incoming request: method, URL, correlationId, userAgent, IP
Logs outgoing response: statusCode, duration in ms, correlationId
Sensitive headers (Authorization, Cookie) are redacted from logs
Middleware applied globally in OpsceModule
Log output is structured JSON for log aggregation compatibility
closes #756

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

@Nanafancy is attempting to deploy a commit to the naijabuz's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

[BE-31] Add structured request logging middleware with correlation IDs in opsce module

1 participant