2 min to read
What is Loki?
A comprehensive guide to Grafana Loki and its components

Overview
Let’s explore Loki, a log aggregation system developed by Grafana Labs, designed specifically for cloud-native environments.
What is Loki?
Loki is a horizontally scalable, highly available log aggregation system designed by Grafana Labs. Unlike traditional logging systems, Loki indexes metadata (labels) rather than log content, making it highly efficient and cost-effective for cloud-native environments.
- Easy Integration
- Supports various log formats and sources
- Simple setup and configuration
- Scalable Storage
- Petabyte-scale capability
- 100% persistence with object storage
- Advanced Functionality
- Metrics generation from logs
- Real-time log tailing
- Native integration with Prometheus and Grafana
Loki Components
Core Components
- Log collection agent
- Runs on each node as a DaemonSet
- Collects and forwards logs to Loki
- Receives and processes log data
- Indexes metadata while keeping log content unindexed
- Distributes incoming logs across ingesters
- Handles load balancing and replication
- Writes log data to storage
- Manages in-memory caching
- Handles data compression
- Processes log queries
- Handles both real-time and historical data
Optional Components
- Query Frontend
- Optimizes and caches queries
- Reduces load on queriers
- Compactor
- Optimizes stored data
- Improves query performance
- Storage Backends
- Supports multiple storage options
- Including file system, S3, GCS
How Promtail Works
Installation and Configuration
Promtail is typically deployed as a DaemonSet in Kubernetes clusters, ensuring log collection from all nodes. Configuration includes:
- Log file locations
- Collection rules
- Labeling configurations
- Loki server endpoints
Log Discovery and Collection Process
- File Discovery
- Automatically finds log files in configured paths
- Typically monitors /var/log/pods/ in Kubernetes
- Metadata Handling
- Extracts metadata from Kubernetes API
- Adds labels like pod name, namespace, node name
- Log Transmission
- Sends logs to Loki server
- Supports local buffering for reliability
Reliability Features
- Local buffering for network issues
- Automatic recovery from Loki server outages
- Efficient log forwarding with batching
- Label-based filtering and processing
Comments