Skip to content

LogQL Supported Queries

Lorenzo Mangani edited this page Sep 23, 2021 · 32 revisions

LogQL: Log Query Language

LogQL is Loki's PromQL-inspired query language. cLoki supports many query types and will continue to introduce more and more. To see Loki's capabilities (aka what cLoki will work to achieve) go to Grafana's LogQL Page

Log Queries

Current functionality is found below, 'missing' functionality is found in the Roadmap.

Line Filter Expressions

  • |=: Log line contains string
  • !=: Log line does not contain string
  • |~: Log line contains a match to the regular expression
  • !~: Log line does not contain a match to the regular expression

Metrics Queries

Log Range Aggregations

  • rate(log-range): calculates the number of entries per second
  • count_over_time(log-range): counts the entries for each log stream within the given range.
  • bytes_rate(log-range): calculates the number of bytes per second for each stream.
  • bytes_over_time(log-range): counts the amount of bytes used by each log stream for a given range.
  • absent_over_time(log-range): returns an empty vector if the range vector passed to it has any elements and a 1-element vector with the value 1 if the range vector passed to it has no elements. (absent_over_time is useful for alerting on when no time series and logs stream exist for label combination for a certain amount of time.)

Aggregation operators

  • sum(count_over_time({label=value}[range])) by (label)

Log Pipeline

  • | json: support for JSON output is working
Clone this wiki locally