Developer Tools
LogQL Query Parser
Break a Grafana Loki LogQL query into its stream selector, label matchers, and pipeline stages, with a plain-language explanation of each part. No signup.
LogQL query parser
Paste a Grafana Loki query. It is parsed entirely in your browser and never uploaded.
Query type
Log query
Label matchers
2
Pipeline stages
3
Stream selector
{app="api", env=~"prod|staging"}app="api"Streams where app is exactly "api".
env=~"prod|staging"Streams where env matches the regular expression "prod|staging".
Pipeline stages
- Line filter
|=errorKeep only log lines that contain this string.
- Parser
jsonParses the line as JSON and promotes its properties to labels. With no arguments it extracts every field; with arguments such as path="x.y" it extracts only the named expressions.
- Label filter
status>= 500Keep results where status is greater than or equal to 500.
Line filters
|=Keep only log lines that contain this string.!=Drop log lines that contain this string.|~Keep only log lines that match this regular expression.!~Drop log lines that match this regular expression.
Label matchers inside the {...}selector use =, !=, =~, and !~. Label filters after a parser stage also use ==, >, >=, <, and <= for numbers, durations, and byte sizes.
Pipeline stages
| json| logfmt| pattern| regexp| unpackextract labels from each line.| line_formatand| label_formatrewrite lines and labels with Go templates.| drop,| keep, and| decolorizemanage labels and strip ANSI colors.| unwrapturns a label into a number for unwrapped range aggregations.
How to use
- Paste a LogQL query into the box, or load one of the built-in samples to see a log query and a metric query broken down.
- Read the query type, the count of label matchers, and the count of pipeline stages in the summary cards at the top.
- Check the stream selector section to see each label matcher with its operator (=, !=, =~, !~) and what it selects.
- Walk the numbered pipeline stages: each line filter, parser stage, label filter, and formatting stage is labeled and explained in order.
- For a metric query, review the range aggregation, its range window such as [5m], and any vector aggregation with its grouping clause.
- Read any notes or problems for missing selectors, unbalanced brackets, or aggregations that need an unwrap or a range, then copy the parsed JSON if you need it. The query stays in your browser.
About this tool
LogQL Query Parser is a browser-based explainer for LogQL, the query language that Grafana Loki uses to search and aggregate logs. A LogQL query has three parts: a stream selector in curly braces that chooses log streams by label, an optional pipeline of stages joined by the pipe character that filters and transforms each line, and, for metric queries, a range aggregation (and optionally a vector aggregation) wrapped around the whole thing. This tool pulls those parts back apart. It reads the stream selector and lists every label matcher with its operator, distinguishing exact equality (=), inequality (!=), regex match (=~), and regex non-match (!~). It splits the pipeline into ordered stages and classifies each one: line filters (|=, !=, |~, !~) that keep or drop lines by substring or regex, parser stages (json, logfmt, pattern, regexp, unpack) that extract fields into labels, label filters that compare typed values with operators such as ==, >, >=, <, and <=, and formatting stages (line_format, label_format, drop, keep, decolorize) that rewrite lines and labels. For metric queries it identifies the range aggregation such as rate, count_over_time, bytes_rate, or the unwrapped variants like sum_over_time and quantile_over_time, reads the range duration in square brackets such as [5m], and recognizes the vector aggregation wrapper (sum, avg, max, topk, bottomk, and the rest) along with any by or without grouping clause and any leading scalar parameter. Each component is shown with the exact text from your query and a short plain-language description of what it does, so a query you inherited from a dashboard or an alert rule becomes readable at a glance. The parser is forgiving and explains problems rather than failing silently: an unbalanced brace or parenthesis, a missing stream selector, a quantile aggregation with no unwrap, or a range aggregation with no duration are all called out as notes or errors. You can copy the parsed structure as JSON to use in documentation or tests. This is a parser and an explainer, not a Loki client: it does not connect to Loki, run the query, or fetch any logs. The query you paste is analyzed entirely in your browser and is never uploaded.
Free to use. Works in your browser. No signup, no login.
Related tools
You may also like
PromQL Formatter
Pretty print a PromQL query into indented lines or a single tidy line, and break down its selectors, label matchers, functions, aggregations, and operators.
Open tool
DeveloperPrometheus Metrics Parser
Read /metrics exposition text into metric families with labels and values, export JSON or NDJSON, or build a valid metric line.
Open tool
DeveloperGrok Pattern Tester
Match a grok pattern against a log line, pull out the named fields it captures, and see the full regular expression it compiles to.
Open tool
DeveloperLogfmt Parser and Formatter
Parse logfmt to JSON or NDJSON and emit clean logfmt from JSON, NDJSON, or rows.
Open tool
DeveloperStatsD Line Parser
Read StatsD and DogStatsD metric lines into name, value, type, sample rate, and tags, flag mistakes, export JSON, or build a valid line.
Open tool
DeveloperInfluxDB Line Protocol Parser
Read InfluxDB and Telegraf line protocol into typed points with tags and fields, export JSON or NDJSON, or build a valid line.
Open tool