Understanding LogQL
Grafana developed LogQL as the query language for Loki using the Prometheus Query Language (PromQL) for inspiration. It was designed with developers (Diego) and operators (Ophelia) in mind (you can refer to Chapter 1 for an introduction to these personas), providing familiar filtering and aggregation mechanisms. Loki does not index the log content. Log events are grouped into log streams and indexed with labels (the log metadata). Executing a LogQL query in Loki invokes a type of distributed filtering against log streams to aggregate the log data.
Let’s explore the Grafana explorer UI for LogQL, where you will be executing most of your LogQL queries.
LogQL query builder
We took a brief look at the Grafana explorer UI in Figure 3.16 in Chapter 3. For our examples, we will mostly work with raw LogQL in the Code editor. The following screenshot shows LogQL typed directly into the query builder code editor:
Figure 4.3 –...