loki

A guide for searching structured JSON application logs stored in Grafana’s Loki log system. It explains how to query service labels and filter fields such as log level, RPC method, duration, and request ID.

In plain words
What is it for?
Investigating Go-service application logs over a time period, filtering by service or deployment, finding errors and slow requests, and tracing requests with an X-Request-ID.
Why use it?
Loki distinguishes searchable stream labels from fields inside each JSON log entry. Knowing the difference helps developers write queries that actually find errors, slow requests, and related traces.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/vmkteam/claude-plugins/loki
Any agent
npx skills add vmkteam/claude-plugins --skill loki
Clone the repo
git clone --depth 1 https://github.com/vmkteam/claude-plugins

Made for: Claude Code, Codex.

Per session 53 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,604 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00053 $0.01604
Opus 5 $0.00026 $0.00802
Sonnet 5 $0.00011 $0.00321
Haiku 4.5 $0.00005 $0.00160

Measured 2d ago against content hash d96c47c85080, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

loki scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/developer/skills/loki/SKILL.md · 145 lines

How it starts

The opening of the file, as written. The whole thing — 145 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Loki — логи vmkteam-сервисов

Loki для логов. Доступен через Grafana datasource proxy. Структурированные JSON-логи из Go-сервисов (appkit).

Подключение

Profile: @{grafana_profile} (через datasource proxy)
Datasource UID: {loki_uid}

Два способа доступа:

Способ Base URL
UID-based (рекомендуется) https://{grafana_host}/api/datasources/uid/{loki_uid}/resources/
Legacy ID-based https://{grafana_host}/api/datasources/proxy/{loki_id}/loki/api/v1/

ВАЖНО: UID-based путь — /resources/query_range, /resources/labels (без /loki/api/v1/ префикса). Legacy — с /loki/api/v1/.

ВАЖНО: Stream labels vs JSON fields

Stream labels (можно использовать в {...} selector):

  • service_name — сервис
  • _node — хост/нода
  • _instance — UUID инстанса
  • _version — версия деплоя

JSON fields (доступны ТОЛЬКО через | json | field=value):

  • level — INFO, ERROR, WARN
  • method — RPC метод
  • platform — desktop, iOS, android, mobile
  • durationMS — длительность в ms (число)
  • err — текст ошибки (<nil> если нет)
  • msg — тип записи (rpc, http, etc.)
  • ip, country, version, userAgent

НЕ ИСПОЛЬЗУЙ level, method, platform в {...} selector — только через | json |.

Правильно: {service_name="{service}"} | json | level="ERROR" Неправильно: {service_name="{service}",level="ERROR"}

Формат лог-записи (appkit JSON)

{
  "time": "2026-04-03T12:00:28.995Z",
  "level": "INFO",
  "msg": "rpc",
  "method": "lists.episodesunwatched",
  "duration": "116.582386ms",
  "durationMS": 116,
  "err": "<nil>",
  "platform": "desktop",
  "ip": "128.65.1.139"
}

Команды pcurl

Поиск логов (UID-based)

# Логи сервиса за 5 минут
pcurl @{profile} "https://{grafana_host}/api/datasources/uid/{loki_uid}/resources/query_range" -s -G \
  --data-urlencode 'query={service_name="{service}"}' \
  --data-urlencode "start=$(date -v-5M +%s)000000000" \
  --data-urlencode "end=$(date +%s)000000000" \
  --data-urlencode 'limit=50'

# Только ошибки
pcurl @{profile} "https://{grafana_host}/api/datasources/uid/{loki_uid}/resources/query_range" -s -G \
  --data-urlencode 'query={service_name="{service}"} | json | level="ERROR"' \
  --data-urlencode "start=$(date -v-1H +%s)000000000" \
  --data-urlencode "end=$(date +%s)000000000" \
  --data-urlencode 'limit=50'

# По RPC методу
pcurl @{profile} "https://{grafana_host}/api/datasources/uid/{loki_uid}/resources/query_range" -s -G \
  --data-urlencode 'query={service_name="{service}"} | json | method="{rpc_method}"' \
  --data-urlencode "start=$(date -v-1H +%s)000000000" \
  --data-urlencode "end=$(date +%s)000000000" \
  --data-urlencode 'limit=50'

# Медленные запросы (>500ms)
pcurl @{profile} "https://{grafana_host}/api/datasources/uid/{loki_uid}/resources/query_range" -s -G \
  --data-urlencode 'query={service_name="{service}"} | json | durationMS > 500' \
  --data-urlencode "start=$(date -v-1H +%s)000000000" \
  --data-urlencode "end=$(date +%s)000000000" \
  --data-urlencode 'limit=50'

# По тексту (line filter — быстрее)
pcurl @{profile} "https://{grafana_host}/api/datasources/uid/{loki_uid}/resources/query_range" -s -G \
  --data-urlencode 'query={service_name="{service}"} |~ "{search_text}"' \
  --data-urlencode "start=$(date -v-1H +%s)000000000" \
  --data-urlencode "end=$(date +%s)000000000" \
  --data-urlencode 'limit=50'

# Ошибки с текстом err (исключая <nil>)
pcurl @{profile} "https://{grafana_host}/api/datasources/uid/{loki_uid}/resources/query_range" -s -G \
  --data-urlencode 'query={service_name="{service}"} | json | err!="<nil>"' \
  --data-urlencode "start=$(date -v-1H +%s)000000000" \
  --data-urlencode "end=$(date +%s)000000000" \
  --data-urlencode 'limit=50'

Read the full file on GitHub · 145 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 145 lines · 53 tokens per session scan A d96c47c85080

Subscribe to this mod's changes

loki is a skill published in the GitHub repository vmkteam/claude-plugins (7 stars, last pushed 4mo ago), licensed MIT. It adds 53 tokens to every session and 1,604 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens

babysit-pr

Babysit a GitHub pull request after creation by continuously polling review comments, CI checks/workflow runs, and mergeability state until the PR is merged/closed or user help is required. Diagnose failures, retry likely flaky failures up to 3 times, auto-fix/push branch-related issues when appropriate, and keep…

openai/codex · 114 tokens

imagegen

Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output…

openai/codex · 113 tokens

agent-host-chat-contributions

Build and review cross-cutting agent-host chat behavior through lifecycle contributions. Use when adding turn lifecycle side effects, prompt or context injection, restored-history transformation, protocol-action observation, or when reviewing changes that add code to AgentSideEffects or AgentService.

microsoft/vscode · 56 tokens