Skip to content
Back to skills

Loki Troubleshoot

ASecurity

Help craft efficient Grafana Loki / LogQL queries for debugging logs — with label‑based filtering, narrow time windows, and best‑practice guidance to avoid expensive or overly broad scans.

  • 666 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added February 9, 2026
developmentdebugging

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add majiayu000/claude-skill-registry --skill loki-troubleshoot --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Loki Troubleshoot?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Loki Troubleshoot
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-loki-troubleshoot/badge)](https://www.skillsdirectory.com/skills/majiayu000-loki-troubleshoot)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: loki-troubleshoot
description: "Help craft efficient Grafana Loki / LogQL queries for debugging logs — with label‑based filtering, narrow time windows, and best‑practice guidance to avoid expensive or overly broad scans."
---

# Loki Troubleshooting & Query‑Builder Skill

## What this Skill does

When a user asks you (Claude) for help inspecting logs via Loki — e.g. “find errors in service X”, “search for request_id=abc123”, “show me 500 responses between 2‑3 PM last night” — use this skill to:

- Ask clarifying questions if needed (e.g. which service / label context, approx time window, any known label names).  
- Build a recommended LogQL query that:  
  - uses **low‑cardinality labels** (service, env, host, etc.) whenever possible  
  - confines to a **narrow time window** (minutes — hours, not days) by default  
  - uses **fast filters** (`|=` or `|!=`) rather than regex or heavy parsing  
  - performs JSON/structured parsing only *after* filtering  
- Provide human-readable explanations and **warnings** for expensive queries  
- Suggest alternative strategies (metrics, recording rules, structured logs)

## Best Practices

- Prefer stable labels (`app`, `env`, `namespace`, `cluster`, etc.)  
- Avoid high-cardinality labels (`user_id`, `request_id`, UUIDs)  
- Always restrict the **time window**  
- Use `|=` before regex or parsing  
- Provide warnings for:  
  - No label selector  
  - Very wide time windows  
  - JSON parse without pre-filter  
  - Regex-heavy queries  

## Example Queries

| User Request                                                                                     | Resulting LogQL                                  |
|--------------------------------------------------------------------------------------------------|--------------------------------------------------|
| "Show me all 500 errors in the `orders` service in the last 2 hours."                            | `{app="orders", env="prod"}[2h] \|= "500"`        |
| "Find logs for request_id `abc123` in staging for `payments` service over past 30 minutes."      | `{app="payments", env="staging"}[30m] \|= "abc123"` |

## Limitations

- This skill does not execute queries

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.