@grow-codes/grafana-loki - v0.1.1
    Preparing search index...

    Class LogQL

    Immutable LogQL builder. Every method returns a new builder.

    LogQL.selector({ app: "x" }).lineContains("err").json().where("status", ">=", 500).toString()
    // {app="x"} |= "err" | json | status >= 500
    Index
    • Line filter |= "text" (case-sensitive substring).

      Parameters

      • text: string

      Returns LogQL

    • Formatting stage | line_format "<template>".

      Parameters

      • template: string

      Returns LogQL

    • Line filter |~ "regex" (RE2; prefix (?i) for case-insensitive).

      Parameters

      • regex: string

      Returns LogQL

    • Parser stage | pattern "<pattern>".

      Parameters

      • pattern: string

      Returns LogQL

    • Appends a raw pipeline stage (| <stage>, e.g. drop level); the text is not escaped.

      Parameters

      • stage: string

      Returns LogQL

    • Parser stage | regexp "<re>" with named capture groups.

      Parameters

      • pattern: string

      Returns LogQL

    • Renders the query. Throws ValidationError when the selector is empty or every matcher also matches the empty string (Loki rejects such selectors).

      Returns string

    • Label filter on an extracted label or structured-metadata key. Numbers use the numeric operators (==, !=, >, >=, <, <=); strings use =, !=, =~, !~.

      Parameters

      • field: string
      • op: "=" | "!=" | "=~" | "!~" | "==" | ">" | ">=" | "<" | "<="
      • value: string | number

      Returns LogQL

    • Quotes a string literal (see quoteLogQL).

      Parameters

      • value: string

      Returns string

    • Starts a query from equality matchers ({app="x", env="prod"}).

      Parameters

      • labels: Readonly<Record<string, string>> = {}

      Returns LogQL