TiloBox
Back to directory
Grafana Loki project preview

Grafana Loki

A log aggregation system with label-based indexing, LogQL queries, ingestion clients, retention, and object-storage support.

LicenseAGPL-3.0
GitHub stars28.8k
Last commit1 weeks ago
Tags7 topics
CliObservabilityObject StorageOpen SourceDeveloper ToolsLogqlLog Aggregation
Overview

Why consider Grafana Loki?

Grafana Loki is an open-source, multi-tenant log aggregation system inspired by Prometheus that indexes log metadata rather than full text. It enables cost-effective log storage and querying across distributed infrastructure.

Guided learning

Learn Grafana Loki by building

Practical setup notes, real use cases, and copy-ready examples in one focused guide.

4 min read 4 sections
In this guide4 sections

Getting Started with Grafana Loki for Log Aggregation

Loki is a horizontally-scalable, highly-available, multi-tenant log aggregation system inspired by Prometheus. Developed by Grafana Labs, it provides an infrastructure-friendly approach to log management across distributed systems. Instead of indexing the full text of incoming messages, Loki does not index the contents of the logs, but rather a set of labels for each log stream.

By storing compressed, unstructured logs and only indexing metadata, Loki is simpler to operate and cheaper to run. This architectural choice drastically cuts storage footprint and eliminates memory-intensive inverted indices. The Loki project was started at Grafana Labs in 2018 and is released under the AGPLv3 license.

Architecture and Ingestion Model

In traditional monitoring environments, correlating metrics with application logs can be tedious due to mismatched identifiers. Loki indexes and groups log streams using the same labels that you are already using with Prometheus. This alignment allows engineers to pivot between metric graphs and related log entries within visualization dashboards without translation layers.

Containerized environments benefit heavily from this labeling paradigm. Metadata such as Pod labels is automatically scraped and indexed for Kubernetes workloads. This makes cluster monitoring straightforward as pod names, namespaces, and deployment tags become direct query dimensions.

For log collection and transport, Alloy replaced Promtail in the stack, because Promtail is considered to be feature complete. Modern deployments use Grafana Alloy as the primary collector agent to discover endpoints, parse local log files, attach labels, and forward streams to Loki.

Underneath the ingestion pipeline, Loki differs from Prometheus by focusing on logs instead of metrics, and delivering logs via push, instead of pull. Log producers send entries asynchronously into distributors and ingesters, where data is buffered before persistence.

Querying and Stream Processing with LogQL

Users can explore logs with LogQL directly within Grafana or through the LogCLI command-line interface. LogQL uses a syntax similar to PromQL, enabling filter expressions, label selectors, and regular expression extractors over raw log lines.

To handle dynamic fields such as transaction IDs and trace IDs without inflating label cardinality, structured metadata allows attaching key-value pairs to log entries without creating new streams. This mechanism preserves high query efficiency while retaining detailed context for each record.

Deploying Loki Locally with Docker

You can install Loki and Alloy with Docker or Docker Compose if you are evaluating, testing, or developing. Running a single-binary instance locally allows developers to test log shipping pipelines and verify LogQL syntax prior to cluster deployment. To launch a containerized instance, run the following Docker command to start Loki with a local configuration mount:

bash
1docker run --name loki -d -v $(pwd):/mnt/config -p 3100:3100 grafana/loki:3.7.0 -config.file=/mnt/config/loki-config.yaml

Security and permissions are configured into the base container image. The official Docker image is configured to run by default as user loki with UID 10001 and GID 10001. When mounting host directories, ensure that the file ownership and volume permissions accommodate this non-root UID.

Once the container starts, when running locally with Docker, Loki exposes endpoints to view readiness and metrics. These administrative endpoints confirm that the ingester and querier components are initialized and accepting traffic on port 3100.

Alerting and Storage Management

Beyond querying, Loki serves as an active component in monitoring workflows. Loki evaluates alerting rules on incoming log data and can send resulting alerts to a Prometheus Alertmanager. This allows development teams to trigger notifications based on specific error thresholds or unexpected log frequency patterns.

For durable persistence across production environments, log data is compressed and stored in chunks in object stores such as Amazon S3, Google Cloud Storage, or the local filesystem. By offloading chunk storage to cost-effective object storage systems, organizations can retain large log archives with minimal operational complexity.

Regarding licensing, the software is distributed under the GNU Affero General Public License Version 3. This copyleft license ensures that source modifications and server enhancements remain available to the broader open-source community.

Related tools

More options with a similar category or technology profile.

Grafana Loki FAQs

Grafana Loki is listed as a Monitoring tool on TiloBox. Review the overview, features, and official documentation on this page to decide whether it solves your specific workflow.

Start with the project's GitHub repository and official website for supported installation and deployment instructions. Test the setup with representative data or a small project before rolling it out more widely.

Grafana Loki is listed under the AGPL-3.0 license. Read the complete license text and the project's notices before using, modifying, or distributing the software.

Production readiness depends on your requirements. Review maintenance activity, security practices, documentation, backup and upgrade procedures, and compatibility with your stack; then validate it in a non-production environment.

Grafana Loki is listed as an alternative to Splunk. Compare the core workflow, deployment model, integrations, and licensing against your must-have requirements before switching.