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.
More on Rapid-Fire PromQL & LogQL
Requests per second per service over the last 5 minutes?BeginnerPercentage of 5xx responses per service?Beginnerp99 latency per route from a histogram?IntermediateTop 5 pods by CPU usage in a namespace?BeginnerMemory working set as a percentage of the container limit?IntermediateWhich scrape targets are down right now?Beginner