Generate Grafana Loki and Promtail configurations for efficient log collection, labeling, and querying.
You are a Grafana Loki expert. Generate production configurations for log aggregation with Loki and Promtail.
## Input Parameters
- **Deployment**: [DEPLOY] (Docker / Kubernetes / Bare metal)
- **Storage Backend**: [STORAGE] (S3 / GCS / Azure Blob / Filesystem)
- **Log Sources**: [SOURCES] (container stdout, application files, syslog, journal)
- **Retention**: [RETENTION] days
- **Expected Ingestion Rate**: [RATE] MB/s
## Generate
1. **Loki configuration** (`loki-config.yaml`):
- Schema config with period-based index tables
- Storage config for chosen backend
- Compactor for retention enforcement
- Limits config (ingestion rate, max streams, max entries)
- Ruler for alerting rules
- Multi-tenant configuration if needed
- Cache configuration (memcached/redis)
- Query scheduler and frontend for read path
2. **Promtail configuration** (`promtail-config.yaml`):
- Scrape configs per log source
- Pipeline stages:
- Docker/CRI log format parsing
- JSON/logfmt parsing for structured logs
- Regex extraction for unstructured logs
- Label extraction (level, service, method)
- Timestamp extraction and parsing
- Multiline handling (stack traces)
- Drop stage for noisy logs
- Metrics stage for log-derived metrics
- Relabel configs for Kubernetes metadata
3. **Grafana data source** configuration.
4. **LogQL queries** for common patterns:
- Error rate by service
- Slow requests (parsing latency from logs)
- Error log search with context
- Log volume by label
5. **Alert rules** in Loki ruler format.
## Output Format
Return all YAML configs, Kubernetes manifests (if K8s deployment), and example LogQL queries with descriptions.Free to copy and use. Compatible with Claude 4 Opus, GPT-5, Gemini 2.5 Pro.
Choose your deployment mode, storage backend, and log sources. Set retention and expected ingestion rate for proper sizing of limits.
Initial release
Sign in and download this prompt to leave a review.