LogQL in 5 minutes Cyril Tovena What is LogQL ? What is LogQL ? - - PowerPoint PPT Presentation

logql in 5 minutes
SMART_READER_LITE
LIVE PREVIEW

LogQL in 5 minutes Cyril Tovena What is LogQL ? What is LogQL ? - - PowerPoint PPT Presentation

LogQL in 5 minutes Cyril Tovena What is LogQL ? What is LogQL ? Language to query logs from Loki. Heavily inspired by PromQL. Distributed grep. | 4 Selecting time series with PromQL http_request_duration_seconds_count{


slide-1
SLIDE 1

Cyril Tovena

LogQL in 5 minutes

slide-2
SLIDE 2
slide-3
SLIDE 3

What is LogQL ?

slide-4
SLIDE 4

| 4

What is LogQL ?

Language to query logs from Loki. Heavily inspired by PromQL. Distributed grep.

slide-5
SLIDE 5

| 5

Selecting time series with PromQL

http_request_duration_seconds_count{ cluster=”us-central1”, job=~”dev/loki-.*” }

Metric name Label matchers

slide-6
SLIDE 6

| 6

Selecting log streams with LogQL

{ cluster=”us-central1”, job=~”dev/loki-.*” } |= “trace_id=7ca877dbda” |~ "SeriesStore." Label matchers Filter expressions Log stream selector:

slide-7
SLIDE 7

| 7

Filter expressions

  • |= Log line contains string.
  • != Log line does not contain string.
  • |~ Log line matches regular expression.
  • !~ Log line does not match regular expression.
slide-8
SLIDE 8

| 8

Counting logs with Range Vectors

rate({ cluster=”us-central1” } |~ “error: .*" [5m]) count_over_time({ cluster=”us-central1” } |= “org_id=5842" [1m])

slide-9
SLIDE 9

| 9

Vector aggregations

sum by(job, instance) ( rate({ cluster=”us-central1” } |= “error" [5m]) ) topk(5, count_over_time({ cluster=”us-central1” } |= “error" [5m]) ) sum, min, max, topk, bottomk, avg , etc..

slide-10
SLIDE 10

Demo

slide-11
SLIDE 11

| 11

LogQL Future

  • Improve query performance.
  • Alert and rules evaluation.
  • Extracting metrics.
  • Log transformation (JSON, Logfmt, ..).
slide-12
SLIDE 12

Thank you ! Questions ? https://grafana.slack.com/

slide-13
SLIDE 13

| 13

Range Vec.. what ?

/api/v1/query_range?query=count_over_time({app=”foo”}[10s]) &start=10 &end=70 &step=20s 10s 10s 10s 10s