loki-expert — субагент для Claude Code: Loki и установка
Субагент loki-expert помогает разворачивать и сопровождать Loki: настраивает сбор логов, запросы LogQL, хранение и связку с Grafana.
MIT ★ 1 029 обновлён 2025-10-15
.claude/agents/loki-expert.mdЧто делает loki-expert
loki-expert разбирает архитектуру Loki, конфигурацию хранилища и работу кластера. Он помогает настроить передачу логов через Promtail, задать политики хранения, собрать запросы на LogQL и подключить Loki к Grafana для визуализации.
Субагент также занимается кэшами индексов и чанков, поиском проблем с приёмом логов и настройкой метрик производительности. В результате он может подготовить конфигурации развёртывания, дашборды и оповещения, документацию, отчёты по оптимизации и правила управления логами.
Для сценария пересылки логов нужен Promtail: без него этот конвейер не заработает. В Claude Code файл субагента размещается по пути .claude/agents/loki-expert.md.
Какие задачи решает
- настроить сбор логов через Promtail
- составить запросы LogQL для Loki
- задать политики хранения логов
- найти причины проблем с приёмом логов
- подключить Loki к Grafana
Примеры запросов агенту
- Настрой Loki для нашего объёма логов и подготовь конфигурацию развёртывания.
- Собери запросы LogQL для поиска ошибок и опиши, какие метки использовать.
- Проверь приём логов через Promtail и предложи настройки кэшей индексов и чанков.
Как установить loki-expert
Вручную: положить файлы
.claude/agents/loki-expert.mdДля всех проектов — ~/.claude/agents/. Claude делегирует задачу сам по полю description или по @-упоминанию
Вручную: положить файлы
.codex/agents/loki-expert.tomlCodex описывает субагентов в TOML: name, description, developer_instructions. Текст из Markdown перенесите в developer_instructions вручную. Для всех проектов — ~/.codex/agents/
Вручную: положить файлы
.cursor/agents/loki-expert.mdCursor понимает и .claude/agents/
По шагам, с командами для каждой платформы: Субагенты Claude Code: как создать, вызвать и не утопить контекст
Вопросы о loki-expert
Как установить loki-expert в Claude Code?
Разместите файл субагента по пути .claude/agents/loki-expert.md.
Что делает loki-expert?
Субагент помогает настраивать Loki, Promtail и LogQL, управлять хранением логов, разбирать проблемы приёма и связывать Loki с Grafana.
Нужен ли Promtail для работы loki-expert?
Promtail используется для построения конвейера передачи логов в Loki. Он нужен для сценария, где субагент настраивает пересылку логов.
Исходный текст
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