Sometimes you want to use trace ids (or request ids) generated earlier during the request to have log correlation across the entire stack.
For example:
- Nginx: if you want to correlate symfony app logs with Nginx access logs, you could use the requestId generated by Nginx as a trace id
- Google Cloud Platform Load Balancers: Google's LBs set a
X-Cloud-Trace-Context
header on each request. If you want to use it to correlate logs including GCP Cloud LB logs, Nginx and Symfony logs, use the following configuration:
instrumentation:
tracing:
request:
incoming_header:
name: x-cloud-trace-context
regex: /^(?<trace>[A-Za-z0-9]{32})(\/(?<span>[A-Za-z0-9]*);?(?<options>((o=(?<sampled>[A-Za-z0-1]*))))?)?$/