authoring-loki-alerting-and-recording-rules

authoring-loki-alerting-and-recording-rules is a skill for Claude Code, Codex from talkops-ai/talkops-mcp. It costs 178 tokens per session (1,672 once invoked), scanned A, original, Apache-2.0.

A procedure for creating Grafana Loki alerting and recording rules. Loki stores logs; alerting rules notify you about matching conditions, while recording rules save calculated results for later use.

In plain words
What is it for?
Use it to write and test LogQL-based alerts, create recording rules, define Loki Operator rule resources, and deploy them after validation.
Why use it?
It helps turn log data into useful alerts without common query errors, noisy notifications, or unnecessarily expensive searches. It also provides checks before deploying rules to Loki or Kubernetes.

Skill for Claude CodeCodex

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

Good fit Use it to write and test LogQL-based alerts, create recording rules, define Loki Operator rule resources, and deploy them after validation.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/talkops-ai/talkops-mcp/authoring-loki-alerting-and-recording-rules
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-loki-alerting-and-recording-rules
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-loki-alerting-and-recording-rules

README.md
[![agentmods](https://agentmods.dev/badge/skills/talkops-ai/talkops-mcp/authoring-loki-alerting-and-recording-rules/github.svg)](https://agentmods.dev/skills/talkops-ai/talkops-mcp/authoring-loki-alerting-and-recording-rules)
Your own site
<a href="https://agentmods.dev/skills/talkops-ai/talkops-mcp/authoring-loki-alerting-and-recording-rules"><img src="https://agentmods.dev/badge/skills/talkops-ai/talkops-mcp/authoring-loki-alerting-and-recording-rules/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-loki-alerting-and-recording-rules

Your own site · 80×15
<a href="https://agentmods.dev/skills/talkops-ai/talkops-mcp/authoring-loki-alerting-and-recording-rules"><img src="https://agentmods.dev/badge/skills/talkops-ai/talkops-mcp/authoring-loki-alerting-and-recording-rules.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 178 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,672 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.00178 $0.01672
Opus 5.5 $0.00071 $0.00669
Sonnet 5.5 $0.00036 $0.00334
Haiku 4.5 $0.00018 $0.00167

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

Security

Grade A, and why

authoring-loki-alerting-and-recording-rules 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/validate_loki_rules.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-loki-alerting-and-recording-rules/SKILL.md · 57 lines

How it starts

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

Authoring Loki Alerting and Recording Rules

Use this skill to author noise-free Grafana Loki alerting rules and cardinality-safe recording rules, backtest their LogQL expressions over live historical logs, validate YAML locally, and deploy via Loki Ruler or Kubernetes Loki Operator with strict 2-phase dry_run safety gates.

Golden Hygiene Rules (references/log-alerting-patterns.md & references/loki-ruler-and-crd-spec.md)

  1. Always Set for: (>= 2m–5m) & Annotations on Alerts: Include for: 5m, severity + service_name labels, and summary, description, and runbook_url annotations. Never define both alert and record on the same rule!
  2. Protect Error Ratios Against Divide-by-Zero + Minimum Volume Floor: Note that clamp_min() is a PromQL-only function and is rejected with HTTP 400 in Loki LogQL! Filter the denominator with > 0 (... / (sum by (...) (rate(...[5m])) > 0) > 0.05) AND require a minimum event count (and sum by (...) (count_over_time(...[5m])) >= 25) so 1 failed probe or idle traffic never pages on-call or divides by zero.
  3. Strict level:metric:operations Colon Naming on Recording Rules: e.g., namespace_service_route:loki_http_errors:rate5m and namespace_service_route:loki_http_duration_ms:p99_5m (always append | __error__="" after | unwrap).
  4. Forbid High-Cardinality Grouping in by (...): Only aggregate by (namespace, service_name, route, status_class)—never group Ruler rules by (session_id, trace_id, user_id, order_id, pod_ip, client_ip) which explodes remote-write Prometheus TSDB series.
  5. Tune Group interval (>= 1m): Avoid interval: 15s on [30m] range queries which overloads queriers and hits maximum of series (500) limits.

Step-by-Step Workflow

Step 1: Inspect Capabilities, References, Ruler Groups & Operator CRDs

  1. Read loki://server/capabilities first to check allow_write (if allow_write: false, perform read-only backtesting + local validate_loki_rules.py validation and output a copy-pasteable GitOps YAML manifest without calling write tools!). Also read commands/setup-monitoring.md when invoked via /setup-monitoring.
  2. Read references/log-alerting-patterns.md when designing alerting/recording LogQL expressions and references/loki-ruler-and-crd-spec.md when rendering Ruler YAML or AlertingRule / RecordingRule CRDs.
  3. Read loki://rules/groups before creating, updating, or deleting Ruler groups.
  4. When working with Kubernetes Loki Operator CRDs (loki.grafana.com/v1), inspect loki://operator/crs/{namespace} and loki://operator/manifests/{kind}/{namespace}/{name} (substituting {kind}, {namespace}, and {name}) via MCP resources rather than raw kubectl so existing spec.tenantID, labels, and sibling rules are preserved!

Read the full file on GitHub · 57 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 · 57 lines · 178 tokens per session scan A eb14580b8ed4

Subscribe to this mod's changes

authoring-loki-alerting-and-recording-rules is a skill published in the GitHub repository talkops-ai/talkops-mcp (4 stars, last pushed 12d ago), licensed Apache-2.0. It adds 178 tokens to every session and 1,672 once invoked, about $0.0007 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-loki-alerting-and-recording-rules compared with skills from other repositories

authoring-loki-alerting-and-recording-rules next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
authoring-loki-alerting-and-recording-rulestalkops-ai/talkops-mcpSkill412d agoApache-2.0A178Claude Code, Codex
agentcore-investigationawslabs/mcpSkill10.0k2d agoApache-2.0A52Claude Code, Codex
auditing-terraform-infrastructure-for-securityxalgorix/xalgorixSkill1.5kyesterdayApache-2.0A59Claude Code, Codex
gcp-triagenirholas/three.wsSkill287yesterdayApache-2.0A93Claude Code
ssh-incidentbvisible/mcp-ssh-managerSkill554yesterdayMITA46Claude Code, Codex
deploy-runbooknirholas/three.wsSkill287yesterdayApache-2.0A38Claude Code
huawei-cloud-waf-aad-rule-managementhuaweicloud/huaweicloud-devkitSkill71todayApache-2.0A338Claude Code