loki

Construct LogQL queries and analyze logs for Grafana Loki deployments.

213|18|Updated Mar 17, 2026
One-click install
npx skills add https://github.com/grafana/skills --skill loki-grafana
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: loki
Source: https://github.com/grafana/skills/tree/main/skills/grafana-lgtm/loki
Command: npx skills add https://github.com/grafana/skills --skill loki-grafana

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Grafana Loki skill helps engineers quickly locate, parse, and analyze logs across distributed systems by providing clear LogQL query guidance, parsing advice, and ingestion configuration recommendations so troubleshooting and metric extraction are faster and more accurate.

Core Features & Use Cases

  • LogQL Query Guidance: Construct selectors, line filters, and metric queries to find errors, rate metrics, and compute aggregates.
  • Parsing & Extraction: Advice for JSON, logfmt, pattern, regexp, and unpack parsers plus label and line_format transformations for structured data.
  • Ingestion & Architecture Guidance: Examples and recommendations for sending logs via Alloy, Promtail, Fluent Bit, or the HTTP push API and an overview of Loki components for scaling and retention.
  • Use Case: Triage a spike in 5xx errors by writing a LogQL query to count errors per service, extracting request durations, and identifying the offending deployment.

Quick Start

Use the loki skill to write a LogQL query that counts error messages per service over the past 5 minutes.

Frequently Asked Questions about loki

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a LogQL query to count 5xx errors per service in Grafana Loki?

To count 5xx errors per service in Grafana Loki, write a LogQL query using selectors and line filters to match error messages, then apply metric aggregations to compute counts grouped by service labels over a specified time range.

What is the best way to parse JSON logs in Loki using LogQL?

The best way to parse JSON logs in Loki is using the LogQL json parser, which extracts structured data from log lines into labels for filtering and aggregation, alongside other parsers like logfmt, pattern, regexp, and unpack.

Can I use Promtail and Alloy together for log ingestion into Loki?

Yes, you can configure log ingestion into Loki using Promtail, Alloy, Fluent Bit, or the HTTP push API. These agents collect and forward logs, with Alloy and Promtail providing tailored configuration options for pipeline stages and labels.

How do I extract metrics from raw log lines using LogQL?

You extract metrics from raw log lines using LogQL by applying parsers like json or logfmt to structure the data, then using range queries and metric aggregations to compute rates and calculate averages over time intervals.

Does Grafana Loki support regex pattern matching for log analysis?

Yes, Grafana Loki supports regex pattern matching for log analysis through the LogQL regexp and pattern parsers, allowing you to define custom extraction rules for unstructured log lines and transform them into queryable labels.

What are the limitations of using LogQL line filters for log aggregation?

LogQL line filters must match exact log line content before aggregation occurs, meaning overly broad filters can return excessive data and impact query performance, so precise selectors and parsers are recommended to limit scope.