akin-ozer/cc-devops-skills/loki-config-generator

Claude Code and agent skill by akin-ozer/cc-devops-skills

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Generate/create Loki configs — ingester, querier, compactor, ruler, S3/GCS/Azure backends.

Install

npx vskill@latest install akin-ozer/cc-devops-skills/loki-config-generator

SKILL.md

Loki Configuration Generator

Overview

Generate production-ready Grafana Loki server configurations with best practices. Supports monolithic, simple scalable, and microservices deployment modes with S3, GCS, Azure, or filesystem storage.

Current Stable: Loki 3.6.2 (November 2025)
Important: Promtail deprecated in 3.4 - use Grafana Alloy instead. See examples/grafana-alloy.alloy for the Alloy pipeline and examples/grafana-alloy-daemonset.yaml for the Kubernetes deployment.

When to Use

Invoke when: deploying Loki, creating configs from scratch, migrating to Loki, implementing multi-tenant logging, configuring storage backends, or optimizing existing deployments.


Generation Methods

Method 1: Script Generation (Recommended)

Use `scripts/generate_config.py` for consistent, validated configurations:

bash
# Simple Scalable with S3 (production)
python3 scripts/generate_config.py \
--mode simple-scalable \
--storage s3 \
--bucket my-loki-bucket \
--region us-east-1 \
--retention-days 30 \
--otlp-enabled \
--output loki-config.yaml
# Monolithic with filesystem (development)
python3 scripts/generate_config.py \
--mode monolithic \
--storage filesystem \
--no-auth-enabled \
--output loki-dev.yaml
# Production with Thanos storage (Loki 3.4+)
python3 scripts/generate_config.py \
--mode simple-scalable \
--storage s3 \
--thanos-storage \
--otlp-enabled \
--time-sharding \
--output loki-thanos.yaml

Script Options:

OptionDescription
--modemonolithic, simple-scalable, microservices
--storagefilesystem, s3, gcs, azure
--auth-enabled / --no-auth-enabledExplicitly enable/disable auth
--otlp-enabledEnable OTLP ingestion configuration
--thanos-storageUse Thanos object storage client (3.4+, cloud backends)
--time-shardingEnable out-of-order ingestion (simple-scalable)
--rulerEnable alerting/recording rules (not monolithic)
--horizontal-compactormain/worker mode (simple-scalable, 3.6+)
--zone-awarenessEnable multi-AZ placement safeguards
--limits-dry-runLog limit rejections without enforcing
Method 2: Manual Configuration

Follow the staged workflow below when script generation doesn't meet specific requirements or when learning the configuration structure.

Output Formats

For Kubernetes deployments, generate BOTH formats:

  1. Native Loki config (loki-config.yaml) - For ConfigMap or direct use
  2. Helm values (values.yaml) - For Helm chart deployments

See examples/kubernetes-helm-values.yaml for Helm format.


Documentation Lookup

When to Use Context7/Web Search

REQUIRED - Use Context7 MCP for:

  • Configuring features from Loki 3.4+ (Thanos storage, time sharding)
  • Configuring features from Loki 3.6+ (horizontal compactor, enforced labels)
  • Bloom filter configuration (complex, experimental)
  • Custom OTLP attribute mappings beyond standard patterns
  • Troubleshooting configuration errors

OPTIONAL - Skip documentation lookup for:

  • Standard deployment modes (monolithic, simple-scalable)
  • Basic storage configuration (S3, GCS, Azure, filesystem)
  • Default limits and component settings
  • Configurations covered in references/ directory
Context7 MCP (preferred)
resolve-library-id: "grafana loki"
get-library-docs: /websites/grafana_loki, topic: [component]

Example topics: storage_config, limits_config, otlp, compactor, ruler, bloom

Web Search Fallback

Use when Context7 unavailable: "Grafana Loki 3.6 [component] configuration documentation site:grafana.com"


Configuration Workflow

Stage 1: Gather Requirements

Deployment Mode:

ModeScaleUse Case
Monolithic<100GB/dayTesting, development
Simple Scalable100GB-1TB/dayProduction
Microservices>1TB/dayLarge-scale, multi-tenant

Storage Backend: S3, GCS, Azure Blob, Filesystem, MinIO

Key Questions: Expected log volume? Retention period? Multi-tenancy needed? High availability requirements? Kubernetes deployment?

Ask the user directly if required information is missing.

Stage 2: Schema Configuration (CRITICAL)

For all new deployments (Loki 2.9+), use TSDB with v13 schema:

yaml
schema_config:
configs:
- from: "2025-01-01" # Use deployment date
store: tsdb
object_store: s3 # s3, gcs, azure, filesystem
schema: v13
index:
prefix: loki_index_
period: 24h

Key: Schema cannot change after deployment without migration.

Stage 3: Storage Configuration

S3:

yaml
common:
storage:
s3:
s3: s3://us-east-1/loki-bucket
s3forcepathstyle: false

GCS: gcs: { bucket_name: loki-bucket } Azure: azure: { container_name: loki-container, account_name: ${AZURE_ACCOUNT_NAME} } Filesystem: filesystem: { chunks_directory: /loki/chunks, rules_directory: /loki/rules }

Stage 4: Component Configuration

Ingester:

yaml
ingester:
chunk_encoding: snappy
chunk_idle_period: 30m
max_chunk_age: 2h
chunk_target_size: 1572864 # 1.5MB
lifecycler:
ring:
replication_factor: 3 # 3 for production

Querier:

yaml
querier:
max_concurrent: 4
query_timeout: 1m

Compactor:

yaml
compactor:
working_directory: /loki/compactor
compaction_interval: 10m
retention_enabled: true
retention_delete_delay: 2h
Stage 5: Limits Configuration
yaml
limits_config:
ingestion_rate_mb: 10
ingestion_burst_size_mb: 20
max_streams_per_user: 10000
max_entries_limit_per_query: 5000
max_query_length: 721h
retention_period: 30d
allow_structured_metadata: true
volume_enabled: true
Stage 6: Server & Auth
yaml
server:
http_listen_port: 3100
grpc_listen_port: 9096
log_level: info
auth_enabled: true # false for single-tenant
Stage 7: OTLP Ingestion (Loki 3.0+)

Native OpenTelemetry ingestion - use otlphttp exporter (NOT deprecated lokiexporter):

yaml
limits_config:
allow_structured_metadata: true
otlp_config:
resource_attributes:
attributes_config:
- action: index_label # Low-cardinality only!
attributes: [service.name, service.namespace, deployment.environment]
- action: structured_metadata # High-cardinality
attributes: [k8s.pod.name, service.instance.id]

Actions: index_label (searchable, low-cardinality), structured_metadata (queryable), drop

⚠️ NEVER use `k8s.pod.name` as index_label - use structured_metadata instead.

OTel Collector:

yaml
exporters:
otlphttp:
endpoint: http://loki:3100/otlp
Stage 8: Caching
yaml
chunk_store_config:
chunk_cache_config:
memcached_client:
host: memcached-chunks
timeout: 500ms
query_range:
cache_results: true
results_cache:
cache:
memcached_client:
host: memcached-results
Stage 9: Advanced Features

Pattern Ingester (3.0+):

yaml
pattern_ingester:
enabled: true

Bloom Filters (Experimental, 3.3+): Only for >75TB/month deployments. Works on structured metadata only. See examples/ for config.

Time Sharding (3.4+): For out-of-order ingestion:

yaml
limits_config:
shard_streams:
time_sharding_enabled: true

Thanos Storage (3.4+): New storage client, opt-in now, default later:

yaml
storage_config:
use_thanos_objstore: true
object_store:
s3:
bucket_name: my-bucket
endpoint: s3.us-west-2.amazonaws.com
Stage 10: Ruler (Alerting)
yaml
ruler:
storage:
type: s3
s3: { bucket_name: loki-ruler }
alertmanager_url: http://alertmanager:9093
enable_api: true
enable_sharding: true
Stage 11: Loki 3.6 Features
  • Horizontally Scalable Compactor: horizontal_scaling_mode: main|worker
  • Policy-Based Enforced Labels: enforced_labels: [service.name]
  • FluentBit v4: structured_metadata parameter support
Stage 12: Validate Configuration (REQUIRED)

Always validate before deployment:

bash
# Syntax and parameter validation
loki -config.file=loki-config.yaml -verify-config
# Print resolved configuration (shows defaults)
loki -config.file=loki-config.yaml -print-config-stderr 2>&1 | head -100
# Dry-run with Docker (if Loki not installed locally)
docker run --rm -v $(pwd)/loki-config.yaml:/etc/loki/config.yaml \
grafana/loki:3.6.2 -config.file=/etc/loki/config.yaml -verify-config

Validation Checklist:

  • [ ] No syntax errors from -verify-config
  • [ ] Schema uses tsdb and v13
  • [ ] replication_factor: 3 for production
  • [ ] auth_enabled: true if multi-tenant
  • [ ] Storage credentials/IAM configured
  • [ ] Retention period matches requirements

Production Checklist

High Availability Requirements

Zone-Aware Replication (CRITICAL for production multi-AZ deployments):

When using replication_factor: 3, ALWAYS enable zone-awareness for multi-AZ deployments:

yaml
ingester:
lifecycler:
ring:
replication_factor: 3
zone_awareness_enabled: true # CRITICAL for multi-AZ
# Set zone via environment variable or config
# Each pod should set its zone based on node topology
common:
instance_availability_zone: ${AVAILABILITY_ZONE}

Why: Without zone-awareness, all 3 replicas may land in the same AZ. If that AZ fails, you lose data.

Kubernetes Implementation:

yaml
# In Helm values or pod spec
env:
- name: AVAILABILITY_ZONE
valueFrom:
fieldRef:
fieldPath: metadata.labels['topology.kubernetes.io/zone']
TLS Configuration (Production Required)

Enable TLS for all inter-component and client communication:

yaml
server:
http_tls_config:
cert_file: /etc/loki/tls/tls.crt
key_file: /etc/loki/tls/tls.key
client_ca_file: /etc/loki/tls/ca.crt # For mTLS
grpc_tls_config:
cert_file: /etc/loki/tls/tls.crt
key_file: /etc/loki/tls/tls.key
client_ca_file: /etc/loki/tls/ca.crt

See examples/production-tls.yaml for complete TLS configuration.

Production Checklist Summary
RequirementSettingRequired For
replication_factor: 3common blockAll production
zone_awareness_enabled: trueingester.lifecycler.ringMulti-AZ
auth_enabled: trueroot levelMulti-tenant
TLS enabledserver blockAll production
IAM roles (not keys)storage configCloud storage
Caching enabledchunk_store_config, query_rangePerformance
Pattern ingesterpattern_ingester.enabledObservability
Retention configuredcompactor + limits_configCost control

Monitoring Recommendations

Key Metrics to Monitor

Configure Prometheus to scrape Loki metrics and alert on these critical indicators:

yaml
# Prometheus scrape config
- job_name: 'loki'
static_configs:
- targets: ['loki:3100']
Critical Alerts
yaml
groups:
- name: loki-critical
rules:
# Ingestion failures
- alert: LokiIngestionFailures
expr: sum(rate(loki_distributor_ingester_append_failures_total[5m])) > 0
for: 5m
labels:
severity: critical
annotations:
summary: "Loki ingestion failures detected"
# High stream cardinality (performance killer)
- alert: LokiHighStreamCardinality
expr: loki_ingester_memory_streams > 100000
for: 10m
labels:
severity: warning
annotations:
summary: "High stream cardinality - review labels"

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
294
Repository forks
32
7-day trend score
28

Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 19 Mar 2026, 7 months ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/akin-ozer/cc-devops-skills/loki-config-generator/badge)](https://verified-skill.com/skills/akin-ozer/cc-devops-skills/loki-config-generator)

Something wrong with this skill or its page? Tell us.