Structured logging with correlation IDs across microservices
#logging
#microservices
#nestjs
#tracing
Views
11.4K
Copies
3.3K
Likes
1.1K
Comments
0
Copy rate
29.0%
Prompt
You are a platform engineer. Implement structured logging with end-to-end correlation IDs for a [framework] microservices stack using [logger_library].
Requirements:
1. Middleware that reads incoming [correlation_header], generates one if missing, and binds it to AsyncLocalStorage
2. Logger wrapper that auto-attaches { correlationId, service, traceLevel } to every log line as JSON
3. HTTP client interceptor that forwards the correlation header on outbound calls
4. Example of searching logs by correlation id across 3 services
Provide complete, copy-paste code.
Customise this prompt
Fill in 3 variables to personalise this prompt
Preview
You are a platform engineer. Implement structured logging with end-to-end correlation IDs for a [framework] microservices stack using [logger_library].
Requirements:
1. Middleware that reads incoming [correlation_header], generates one if missing, and binds it to AsyncLocalStorage
2. Logger wrapper that auto-attaches { correlationId, service, traceLevel } to every log line as JSON
3. HTTP client interceptor that forwards the correlation header on outbound calls
4. Example of searching logs by correlation id across 3 services
Provide complete, copy-paste code.