Loki Config Generator
Generate production-ready Grafana Loki configurations in YAML. Configure auth, storage backends, ingester, querier, compactor, ruler, and limits for scalable log aggregation.
Loki Configuration
1auth_enabled: false23common:4 path_prefix: /loki5 storage:6 filesystem:7 chunks_directory: /loki/chunks8 rules_directory: /loki/rules9 replication_factor: 11011server:12 http_listen_port: 310013 grpc_listen_port: 909614 log_level: info1516limits_config:17 ingestion_rate_mb: 1618 ingestion_burst_size_mb: 3219 max_entries_limit_per_query: 1000020 retention_period: 744h2122schema_config:23 configs:24 - from: "2024-01-01"25 store: tsdb26 object_store: filesystem27 schema: v1328 index:29 prefix: index_30 period: 24h3132storage_config:33 filesystem:34 directory: /loki/chunks3536 tsdb_shipper:37 active_index_directory: /loki/index38 cache_location: /loki/cache39 shared_store: s34041compactor:42 working_directory: /loki/compactor43 shared_store: s34445distributor:46 ring:47 kvstore:48 store: inmemory49 replication_factor: 15051ingester:52 lifecycler:53 ring:54 kvstore:55 store: inmemory56 replication_factor: 157 max_transfer_retries: 1058 chunk_idle_period: 5m59 max_chunk_age: 2h60 chunk_target_size: 157286461 chunk_retain_period: 30s6263querier:64 max_concurrent: 106566query_range:67 split_queries_by_interval: 30m68 cache_results: true6970results_cache:71 cache:72 embedded_cache:73 enabled: true74 max_size_mb: 100
What is this tool?
The Loki Config Generator produces production-ready config.yaml files for Grafana Loki, a horizontally-scalable, highly-available log aggregation system. Unlike full-text search engines like Elasticsearch, Loki indexes only labels — making it cost-effective and operationally simple for massive log volumes.
Loki's architecture mirrors Prometheus for metrics: it uses label-based indexing, LogQL for queries, and supports multiple storage backends including filesystem, S3, Azure Blob Storage, and Google Cloud Storage. This generator covers every Loki component — distributor, ingester, querier, query-frontend, compactor, ruler, and storage — producing valid YAML ready for deployment.
How to Use This Tool
1. Auth & Server: Configure multi-tenancy with auth_enabled and set server ports for HTTP (3100) and gRPC (9096) communication between Loki components.
2. Distributor: Receives incoming log streams via HTTP/gRPC, validates them, and distributes chunks across ingesters using consistent hashing ring with configurable replication factor.
3. Ingester: Receives log streams from distributors, buffers them in memory, and flushes compressed chunks to long-term storage. Configure chunk lifecycle with chunk_idle_period, max_chunk_age, and chunk_target_size.
4. Storage: Select the chunk and index storage backend — filesystem for single-node, S3/Azure/GCS for cloud deployments. Index stores are configured separately via boltdb-shipper or TSDB.
5. Querier & Query Frontend: Execute LogQL queries against ingesters and storage. The query frontend splits queries by time interval and retries failed requests for resilience.
6. Compactor: Merges and deduplicates index and chunk files in object storage to reduce storage costs and improve query performance.
7. Ruler: Evaluates recording and alerting rules against Loki, enabling log-based alerting via Alertmanager integration.
Best Practices
- Always configure a replication_factor of at least 3 for production ingester rings to ensure log durability.
- Use TSDB as the index store for new deployments — it offers better performance and compaction than boltdb-shipper.
- Set retention_period on limits_config to control storage costs and comply with data retention policies.
- Configure chunk_target_size (1.5MB default) and chunk_idle_period to balance memory usage and flush frequency.
- Deploy the compactor with a shared_store matching your storage backend to keep index files optimized.
- Use split_queries_by_interval in query frontend to parallelize large time-range queries across multiple queriers.
Common Mistakes
- Running auth_enabled: true without configuring X-Scope-OrgID headers on push endpoints, causing all writes to fail.
- Setting replication_factor higher than the number of ingester instances, resulting in stuck flushes and data loss.
- Using filesystem storage in multi-instance deployments — filesystem is single-node only, use S3/Azure/GCS for distributed setups.
- Forgetting to configure the schema_config with a valid from date, which causes Loki to reject all incoming data.
- Not setting max_transfer_retries on ingesters during rolling updates, leading to unflushed chunks being lost.
Security Notes
- Enable auth_enabled in production and enforce X-Scope-OrgID headers to isolate tenants.
- Store S3 access keys, Azure account keys, and GCS service accounts in environment variables or secret managers — never in config files.
- Use TLS for gRPC communication between Loki components (distributor ↔ ingester, querier ↔ store-gateway).
- Restrict the ruler's alertmanager_url to an internal network and use mutual TLS.
- Apply network policies to limit which services can reach the Loki HTTP and gRPC ports.
Production Tips
- Use the microservices deployment mode (separate distributor, ingester, querier, etc.) for clusters above 50GB/day log ingestion.
- Configure ingester lifecycler with a ring kvstore using consul or etcd for production — avoid the in-memory ring.
- Deploy a read-write path split: ingesters + distributors on the write path, queriers + store-gateways on the read path.
- Monitor Loki with its own /metrics endpoint — track ingester flush rates, querier latency, and compactor run durations.
- Use LogQL metric queries (rate, count_over_time) for alerting instead of grep-like filters to reduce query load.
- Set max_entries_limit_per_query (default 10000) conservatively to prevent OOM on queriers with high-cardinality label sets.
Frequently Asked Questions
What is Grafana Loki and how does it differ from Elasticsearch?
What storage backends does Loki support?
What is the difference between boltdb-shipper and TSDB?
How does Loki handle multi-tenancy?
What is LogQL?
How do I deploy Loki in production?
What is the Loki ruler and when should I use it?
How We Keep Your Configs Safe & Valid
Built-in Error Checking
Every file is checked against official rules. We catch missing fields and bad syntax. YAML indentation errors are flagged right away. Kubernetes, Terraform, and Docker specs are all covered. API versions and labels are verified too. You get valid output every time you generate.
100% Private & Local
All tools run in your browser only. Your API keys never leave your machine. We do not use any tracking scripts. No data is sent to any server. Passwords and secrets stay on your device. Crypto operations use the Web Crypto API. Your privacy is fully protected at all times.
Secure Settings by Default
Configs use safe defaults out of the box. Containers run as non-root users. Root filesystems are set to read-only. Dangerous Linux capabilities are dropped. Network policies limit pod-to-pod traffic. TLS 1.3 is enabled for web servers. Security headers are added where needed.
Ready for CI/CD & Git
Output files are ready for your Git repo. Use them with ArgoCD, Flux, or GitHub Actions. Files use clear formatting and comments. Code review is easy for your team. Indentation and key order are consistent. Test in staging before going to production. Every file is clean and well-structured.
Infrastructure as Code
Store configs in Git alongside your code. Terraform modules include typed variables. Backend configs support remote state locking. Outputs work across multiple modules. Ansible playbooks use clear task steps. Chef and Puppet configs are also supported. Every file works with version control tools.
Monitoring & Tracing
Set up Prometheus with auto-discovery rules. Create Grafana dashboards with template variables. Add alerting rules with severity labels. Use OpenTelemetry for trace collection. Forward logs to Loki or Elasticsearch. Connect to Jaeger or Tempo for tracing. Monitor metrics, logs, and traces together.
Container & Docker Safety
Dockerfiles use multi-stage builds for small images. Base images are pinned to exact versions. Dev files are excluded from final images. Health checks are added for orchestrator use. Containers switch to non-root users. Docker Compose uses named volumes and networks. Resource limits are set in deploy configs.
Multiple Output Formats
Export as YAML, JSON, HCL, or TOML. Kubernetes uses YAML with proper separators. Terraform uses HCL with correct escaping. JSON output has consistent indentation. Copy to clipboard with one click. Preview output with syntax highlighting. Line numbers help you review quickly.