Zero Signup ToolsFree browser tools

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

  1. Line filter|=error

    Keep only log lines that contain this string.

  2. Parserjson

    Parses 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.

  3. Label filterstatus>= 500

    Keep 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 | unpack extract labels from each line.
  • | line_format and | label_format rewrite lines and labels with Go templates.
  • | drop, | keep, and | decolorize manage labels and strip ANSI colors.
  • | unwrap turns a label into a number for unwrapped range aggregations.

How to use

  1. 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.
  2. Read the query type, the count of label matchers, and the count of pipeline stages in the summary cards at the top.
  3. Check the stream selector section to see each label matcher with its operator (=, !=, =~, !~) and what it selects.
  4. Walk the numbered pipeline stages: each line filter, parser stage, label filter, and formatting stage is labeled and explained in order.
  5. For a metric query, review the range aggregation, its range window such as [5m], and any vector aggregation with its grouping clause.
  6. 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

All tools
All toolsDeveloper Tools