Interview Prep/Monitoring & Observability/Rapid-Fire PromQL & LogQL

LogQL: find every log line for a trace ID and print it compactly?

IntermediateProductionRapid-Fire PromQL & LogQL
Answer
{namespace=~"prod|payments"} |= "4bf92f3577b34da6a3ce929d0e0e4736"
  | json | line_format "{{.app}} {{.level}} {{.msg}}"

Filter by the raw string before json so parsing only runs on matching lines. If trace_id is stored as structured metadata, | trace_id="4bf9..." is faster still.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Rapid-Fire PromQL & LogQL