authoring-logql-and-analyzing-logs

authoring-logql-and-analyzing-logs is a skill for Claude Code, Codex from talkops-ai/talkops-mcp. It costs 197 tokens per session (1,765 once invoked), scanned A, original, Apache-2.0.

A procedure for writing and running Grafana Loki LogQL queries. LogQL is a language for searching logs and calculating metrics from them.

In plain words
What is it for?
Use it to find errors and patterns in logs, extract fields, calculate rates or durations, and optimize queries for production data.
Why use it?
It helps avoid slow or overly broad searches, parser errors, and excessive memory use when examining large log collections. It checks query cost and structure before execution.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to find errors and patterns in logs, extract fields, calculate rates or durations, and optimize queries for production data.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/talkops-ai/talkops-mcp/authoring-logql-and-analyzing-logs
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.

Any agent
npx skills add talkops-ai/talkops-mcp --skill authoring-logql-and-analyzing-logs
Clone the repo
git clone --depth 1 https://github.com/talkops-ai/talkops-mcp

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for authoring-logql-and-analyzing-logs

README.md
[![agentmods](https://agentmods.dev/badge/skills/talkops-ai/talkops-mcp/authoring-logql-and-analyzing-logs/github.svg)](https://agentmods.dev/skills/talkops-ai/talkops-mcp/authoring-logql-and-analyzing-logs)
Your own site
<a href="https://agentmods.dev/skills/talkops-ai/talkops-mcp/authoring-logql-and-analyzing-logs"><img src="https://agentmods.dev/badge/skills/talkops-ai/talkops-mcp/authoring-logql-and-analyzing-logs/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for authoring-logql-and-analyzing-logs

Your own site · 80×15
<a href="https://agentmods.dev/skills/talkops-ai/talkops-mcp/authoring-logql-and-analyzing-logs"><img src="https://agentmods.dev/badge/skills/talkops-ai/talkops-mcp/authoring-logql-and-analyzing-logs.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 197 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,765 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00197 $0.01765
Opus 5.5 $0.00079 $0.00706
Sonnet 5.5 $0.00039 $0.00353
Haiku 4.5 $0.00020 $0.00177

Measured 11d ago against content hash 5542e0aac261, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

authoring-logql-and-analyzing-logs 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 11d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/lint_logql.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

src/loki-mcp-server/skills/authoring-logql-and-analyzing-logs/SKILL.md · 61 lines

How it starts

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

Authoring LogQL and Analyzing Logs

Use this skill to construct, lint, preflight cost-check, and execute production-grade Grafana Loki 3.x LogQL log and metric queries without triggering full-index scans, SampleExtractionErr aborts, or querier OOMs.

Mandatory 4-Stage LogQL Pipeline Order

Always order LogQL stages strictly from cheapest to most expensive (see references/logql-syntax-and-functions.md and references/query-templates-and-anti-patterns.md):

  1. Stream Selector ({...}): Bound at least one positive non-wildcard indexed label ({service_name="<service>", namespace="<namespace>"}). Never execute empty {} or wildcard-only {service_name=~".*"}, and never put high-cardinality fields (trace_id, order_id, user_id, k8s.pod.name) inside {}.
  2. Line Filter (|=, !=, |~, !~): Place SIMD/Bloom-accelerated literal substring filters (|= "ERROR", |= "duration_ms", |= "status=403") before any parser!
  3. Targeted Parser (| pattern, | logfmt, | json):
    • Prefer | pattern (5–10x faster than | regexp) for space-delimited Nginx/Envoy logs.
    • Prefer targeted extraction (| json status="status", duration_ms="duration_ms" or | logfmt status, client_ip) instead of bare | json.
    • Loki 3.x Structured Metadata Shortcut: When k8s.pod.name, trace_id, or severity_text already live in chunk-header structured_metadata (parser: ""), filter directly via {service_name="<service>", namespace="<namespace>"} | k8s.pod.name="..." | severity_text="ERROR" without | json or | logfmt!
  4. Label/Metadata/IP Filters & Unwrap:
    • Use ip("10.0.0.0/8") for CIDR matching (| client_ip != ip("10.0.0.0/8")).
    • Always append | __error__="" immediately after | unwrap <field> (| unwrap duration_ms | __error__="") to prevent SampleExtractionErr.
    • Divide-by-Zero Protection in LogQL Ratios: Note that clamp_min() is a PromQL-only function and is rejected with HTTP 400 in LogQL! Protect LogQL error-ratio denominators from NaN / divide-by-zero on idle intervals using (sum by (...) (rate(...[5m])) > 0) in the denominator (and or vector(0) on the numerator if needed).

Read the full file on GitHub · 61 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 11d ago First seen · 61 lines · 197 tokens per session scan A 5542e0aac261

Subscribe to this mod's changes

authoring-logql-and-analyzing-logs is a skill published in the GitHub repository talkops-ai/talkops-mcp (4 stars, last pushed 12d ago), licensed Apache-2.0. It adds 197 tokens to every session and 1,765 once invoked, about $0.0008 per session on Opus 5.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-11-18.

Related

authoring-logql-and-analyzing-logs compared with skills from other repositories

authoring-logql-and-analyzing-logs next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
authoring-logql-and-analyzing-logstalkops-ai/talkops-mcpSkill412d agoApache-2.0A197Claude Code, Codex
chrome-devtools-cliChromeDevTools/chrome-devtools-mcpSkill60ktodayApache-2.0A31Claude Code
n8n-validation-expertczlonkowski/n8n-mcpSkill23k3d agoMITA91Claude Code, Codex
n8n-error-handlingczlonkowski/n8n-mcpSkill23k3d agoMITA128Claude Code, Codex
agentcore-investigationawslabs/mcpSkill10.0k2d agoApache-2.0A52Claude Code, Codex
openlore-analyze-codebaseclay-good/OpenLoreSkill369todayMITA48Claude Code, Codex
flutter-mcp-toolkit-intentcall-migrationArenukvern/mcp_flutterSkill4013d agoMITA58Claude Code