Grafana Loki 2.8 release: TSDB GA, LogQL enhancements, and a third target for scalable mode
Grafana Loki 2.8 is here — and it’s at least 0.1 better than Loki 2.7!
Jokes aside, this release includes a number of improvements users will appreciate. In addition to graduating our TSDB index from Experimental to General Availability, we’ve added a number of nifty LogQL features, and we’ve made the Loki deployment and management experience much easier.
This also marks the release of Grafana Enterprise Logs (GEL) 1.7. Note that all the features discussed here are part of both Loki 2.8 and GEL 1.7. So, for simplicity, we will just refer to Loki 2.8 in the remainder of this post.
Let’s dive in!
Ease-of-use updates: TSDB and LogQL
We always strive to introduce features that will aid with ease of use and performance with our releases, and Loki 2.8 is no different. Here are some of the highlights:
TSDB is no longer experimental
As part of our Loki 2.7 release, we extensively highlighted our new TSDB index and the performance benefits it offers. With our Loki 2.8 release, we are happy to announce that we are removing the experimental
designation.
Directly inspired by the Prometheus TSDB storage format, the TSDB index can dramatically reduce your object storage footprint and help you consume fewer resources at query time. We run the TSDB index in all of our own Loki environments, and we encourage you to do the same! Please take a look at our TSDB TSDB docs to get started, if you haven’t already.
LogQL enhancements
The Loki 2.8 release saw a number of noteworthy additions to LogQL, Loki’s PromQL-inspired query language. For example, the new sort
and sort_desc
functions allow you to sort vector elements by their values. Plus, you can now use drop
expression to drop labels in the query pipeline. Prior to this, you typically needed an aggregation function to remove labels from a result — something that isn’t possible for a log query. Now you have the option to remove labels from a result in both metric and logs queries using drop
. See our log queries documentation for more examples.
We also added a number of new template functions:
- count counts the occurrences of a a regex match
- urlencode/urldecode URL encodes or URL decodes a string
- bytes converts humanized byte strings like 3kB to 3000
- duration converts a humanized time string into a seconds value, e.g. 5 m becomes 300
- unixEpochMillis/unixEpochNanos is an extension of the existing unixEpoch, which can turn date values into unix millis or unix nanos.
- toDateInZone is just like toDate but allows you to specify a timezone
- b64Enc/b64dec will allow you to base64 encode or decode a string
And finally, the LogQL prettifier, which is inspired by the PromQL prettifier, helps with readability and execution flow of LogQL. The prettifier is exposed as a Loki API endpoint and also in LogCLI. (Look for this capability to be built into Grafana directly in the future!)
Here’s an example of the prettifier in action:
Before
quantile_over_time(0.99,{container="ingress-nginx",service="hosted-grafana"}| json| unwrap response_latency_seconds| __error__=""[1m]) by (cluster)
After
quantile_over_time(
0.99,
{container="ingress-nginx", service="hosted-grafana"} | json
| unwrap response_latency_seconds
| __error__="" [1m]
) by (cluster)
Third target added to scalable mode
The Loki team has embraced scalable mode (or simple scalable deployment) as the best way to run Loki for most use cases. Scalable mode reduces a versatile but somewhat complex deployment so users only have to worry about two components: “read” and “write.”
While this simplified deployment significantly and proved to be very successful with our community, we still want to give our users additional flexibility without adding too much complexity. Hence, Loki 2.8 adds a third component to our scalable deployment mode: “backend.” By doing this, the read path can be run as a deployment and more easily autoscaled. It also brings Loki into alignment with our sister Grafana Mimir team, which is also using a three target model for their scalable deployment.
As part of this change, we have also updated our Helm chart to reflect the three-target mode, but we’ve done it in a way that doesn’t break those deploying in the existing read/write mode. As we announced in December, Loki has standardized on a single Helm chart that we believe best reflects the collective needs of our user base. This is an area where we at Grafana Labs want to work with our community and concentrate our efforts on making Loki easier to run. Please read our migration docs to learn how to move from the two target to the three target scalable mode.
Check out Loki 2.8 today
Thanks to all the Grafana Loki users and contributors out there who continue to help grow the project.
If you run Loki, be sure to check out the release notes and upgrading guide for more details on getting started with Grafana Loki 2.8 today!
If you run Grafana Enterprise Logs, be sure to check out the release notes and documentation for GEL 1.7, which is based off of Loki 2.8, so you can enjoy all the amazing changes made to the upstream OSS project!
Grafana Cloud is the easiest way to get started with metrics, logs, traces, and dashboards. We have a generous free forever tier and plans for every use case. Sign up for free now!