1. Habit
  2. Skills
  3. Loki skill
grafana · 7K installs

Loki skill
Runs by itself, every hour.

Log errors spotted every hour.

Install the Loki skill and make it a habit: follow https://gethabit.dev/skills/grafana/loki.md

  1. 1Copy
  2. 2Paste into Claude Code, Codex or Cursor
  3. 3It runs by itself

7K installs289 starsApache-2.0 licenceSource on GitHub ↗

Loki

by grafana · 7K installs

The skill

The loki skill covers Grafana Loki and the LogQL query language: stream selectors, line filters, parsers, metric queries, log ingestion and architecture.

Only when you ask.

The habit

Log errors spotted every hour.

↻ Runs by itselfevery hour

How the habit works.
You don't have to.

Three questionsWhen does it start? How does it check its work? What does it remember?

One run, step by step.
Then it stops.

Stop ruleStops after five queries per run, with one retry per query.

  1. 01

    Select streams

    Your agent starts each query with a label selector such as env="prod".

  2. 02

    Filter early

    It puts line filters like |= "error" first for speed.

  3. 03

    Parse fields

    It uses json, logfmt or pattern parsers to read status and duration.

  4. 04

    Compute rates

    It runs sum(rate(...)) by service and compares with offset 1h.

  5. 05

    Find slow and 5xx

    It lists requests with duration > 1s and status >= 500.

  6. 06

    Log and flag

    It writes the rates to the log and flags services above the threshold.

What it may do.
Nothing more.

Safe by defaultIt writes only in its own folder and asks you before anything goes out.

Is it for you?
Use it when it fits.

Quick checkRead both lists. If the left one sounds like you, the Loki skill helps.

Use it when

  • ✓ You write LogQL queries
  • ✓ You build an error rate alert
  • ✓ You set up log shipping with Alloy

Skip it when

  • – You do not use Grafana Loki
  • – You need full-text search across all log content

Questions

Loki skill, answered.

Why put line filters first?

Line filters are the first pipeline stage, and the skill places them first for performance.

What does Loki index?

Only the labels, not the full log text.

Can it help with ingestion too?

Yes. The skill also covers sending logs with Grafana Alloy, Promtail, Fluent Bit and the HTTP push API.

How do I install the Loki skill?

Copy the prompt at the top into your agent. It installs the skill from grafana/skills and sets up the habit. Or run npx skills add grafana/skills --skill loki.

Is the Loki skill free?

Yes. It is published under Apache-2.0. Habit is free too.

Loki. Now as a habit.

Install the Loki skill and make it a habit: follow https://gethabit.dev/skills/grafana/loki.md

  • Free
  • No account
  • Undo in one line

All grafana skills →More ops skills →

Works in

  • Claude Code
  • Codex
  • Cursor
  • ChatGPT
  • Claude app

Made by grafana, published under Apache-2.0. Habit links to the original and never changes it. Is this your skill?

Copying didn't work here. Select the line and copy it by hand.