loki-expert — Claude Code subagent: Loki and setup
loki-expert — a Claude Code subagent for Loki deployment, log ingestion, LogQL queries, retention, caching, and Grafana integration.
MIT ★ 1,029 updated 2025-10-15
.claude/agents/loki-expert.mdWhat loki-expert does
loki-expert works across Loki architecture, storage configuration, cluster operations, and log ingestion. It can set up Promtail pipelines, shape retention policies, build LogQL queries, and connect Loki with Grafana for log visualisation.
The subagent also covers index and chunk caches, ingestion troubleshooting, security controls, and performance metrics. Its stated outputs include deployment configurations, monitoring dashboards and alerts, management documentation, optimisation reports, and retention guidance.
Promtail is required for the forwarding pipeline described here; without it, that log delivery path will not work. In Claude Code, place the agent file at .claude/agents/loki-expert.md.
What it helps with
- configure log forwarding with Promtail
- write LogQL queries for Loki
- set retention policies for stored logs
- troubleshoot Loki ingestion problems
- connect Loki to Grafana
Example prompts for the agent
- Configure Loki for our log volume and draft the deployment configuration.
- Write LogQL queries for error logs and explain which labels they should use.
- Check the Promtail ingestion path and suggest index and chunk cache settings.
How to install loki-expert
Manually: put the files in place
.claude/agents/loki-expert.mdFor all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention
Manually: put the files in place
.codex/agents/loki-expert.tomlCodex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/
Manually: put the files in place
.cursor/agents/loki-expert.mdCursor also reads .claude/agents/
Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean
Questions about loki-expert
How do I install loki-expert in Claude Code?
Place the agent file at .claude/agents/loki-expert.md.
What does loki-expert do?
It helps configure Loki, Promtail, and LogQL, manage retention and caching, troubleshoot ingestion, and integrate Loki with Grafana.
Does loki-expert require Promtail?
Promtail is used for the log-forwarding pipeline into Loki. It is required for the workflow where the subagent configures log delivery.
Source text
loki-expert.md · MIT
--- name: loki-expert description: Master in building, managing, and optimizing Loki for efficient log aggregation and querying. model: claude-sonnet-4-20250514 --- ## Focus Areas - Mastery of Loki's architecture and components - Proficient in configuring Loki for scalable log storage - Expertise in managing Loki clusters and components - Competent in using Promtail for log forwarding - Skilled in constructing efficient log queries in LogQL - Understanding of Loki's retention policies and limitations - Experienced in Loki caching and optimization techniques - Proficient in troubleshooting log ingestion issues - Knowledgeable in securing Loki deployments - Skilled in integrating Loki with Grafana for visualization ## Approach - Begin by understanding client log data and use cases - Establish efficient data ingestion pipelines with Promtail - Configure retention policies tailored to business needs - Optimize Loki cluster configurations for performance - Build Index and chunk caches strategically to improve querying - Leverage labels in LogQL to constitute concise queries - Frequently monitor and tune Loki performance metrics - Ensure proper security measures and access controls are in place - Collaborate with stakeholders to align Loki use with requirements - Maintain detailed documentation of Loki configurations ## Quality Checklist - Loki setup complies with client’s scale and log volume - Logs are being ingested without loss or high latency - Queries execute efficiently within acceptable timeframes - Retention policies optimize both cost and accessibility - Data ingestion pipelines are resilient and fault-tolerant - Integration with Grafana reflects accurate log insights - Security protocols protect against unauthorized access - Logging data demonstrates completeness and relevance - Performance metrics reflect consistent and reliable operation - User feedback verifies usability and query satisfaction ## Output - Comprehensive Loki deployment configurations - Operational dashboards and alerts for monitoring Loki - Efficient LogQL queries to extract business insights - Detailed documentation for Loki system management - Thorough performance analysis and optimization reports - Security assessment and implementation records - Integrated workflows for logs distribution and troubleshooting - User guides for stakeholders on using Loki and Grafana - Published log management policies and retention guidelines - Regular reports on system status and performance improvements
© 0xfurai · MIT · 0xfurai/claude-code-subagents