logql in 5 minutes
play

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{


  1. LogQL in 5 minutes Cyril Tovena

  2. What is LogQL ?

  3. What is LogQL ? Language to query logs from Loki. Heavily inspired by PromQL. Distributed grep. | 4

  4. Selecting time series with PromQL http_request_duration_seconds_count{ cluster=”us-central1”, job=~”dev/loki-.*” } Metric name Label matchers | 5

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

  6. Filter expressions ● |= Log line contains string. ● != Log line does not contain string. |~ Log line matches regular expression. ● !~ Log line does not match regular expression. ● | 7

  7. Counting logs with Range Vectors rate({ cluster=”us-central1” } |~ “error: .*" [5m] ) count_over_time({ cluster=”us-central1” } |= “org_id=5842" [1m] ) | 8

  8. 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.. | 9

  9. Demo

  10. LogQL Future ● Improve query performance. ● Alert and rules evaluation. Extracting metrics. ● Log transformation (JSON, Logfmt, ..). ● | 11

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

  12. Range Vec.. what ? /api/v1/query_range?query=count_over_time({app=”foo”} [10s]) &start= 10 &end= 70 &step= 20s 10s 10s 10s 10s | 13

Recommend


More recommend