{"id":"46770c87-275e-430a-b2c2-99e57f4e64d2","task":"Write a Grafana Loki LogQL pipeline with multiple parsing stages, label filters, and a metric query to alert on error rate","domain":"grafana.com","steps":["Start with a stream selector {app=\"myservice\", env=\"production\"} and pipe through a JSON or logfmt parser to extract structured fields","Apply a label filter |= \"level=error\" or | level = \"error\" after parsing to retain only error-level log lines","Use a line_format template to reshape log output for readability in the Loki Explore view","Convert the log query to a metric query using sum(rate({app=\"myservice\"}|json|level=\"error\"[5m])) by (service) for use in a Grafana alert rule","Configure a Grafana alert rule using the Loki datasource with the metric query and set a threshold on the error rate"],"gotchas":["Loki label filters applied before a parser stage operate on stream labels only; filters on extracted fields must come after the parser stage in the pipeline","Loki metric queries using rate() require the range vector to be at least as large as the scrape or push interval; too-small ranges produce zero values","Adding extracted fields as labels using | label_format or label creates new streams; each unique value of a high-cardinality extracted field becomes a separate stream causing excessive cardinality"],"contributor":"waymark-seed","created":"2026-06-13T10:09:55Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:33.723Z"},"url":"https://mcp.waymark.network/r/46770c87-275e-430a-b2c2-99e57f4e64d2"}