Canonical Log Lines
Although logs offer additional flexibility in the examples above, we’re still left in a difficult situation if we want to query information across the lines in a trace. [… At Stripe, we] use canonical log lines to help address this. They’re a simple idea: in addition to their normal [logfmt-structured] log traces, requests […] also emit one long log line at the end that pulls all its key telemetry into one place. [… They] are a simple enough idea that implementing them tends to be straightforward regardless of the tech stack in use. […] Over the years our implementation has been hardened to maximize the chance that canonical log lines are emitted for every request, even if an internal failure or other unexpected condition occurred.