logql-generator

Generate LogQL queries for Grafana Loki with label matchers and aggregations.

9|Updated Feb 21, 2026
One-click install
npx skills add https://github.com/pantheon-org/tekhne --skill logql-generator-pantheon-org
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: logql-generator
Source: https://github.com/pantheon-org/tekhne/tree/main/skills/observability/logql-generator
Command: npx skills add https://github.com/pantheon-org/tekhne --skill logql-generator-pantheon-org

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill simplifies the creation of complex LogQL queries for Grafana Loki, enabling users to efficiently analyze logs, build dashboards, and set up alerts without deep expertise in the query language.

Core Features & Use Cases

  • LogQL Query Generation: Creates label matchers, line filters, aggregations, and metric queries.
  • Interactive Planning: Guides users through requirements gathering and query planning.
  • Reference Integration: Leverages local and external documentation for accuracy.
  • Use Case: A DevOps engineer needs to create a LogQL query to find the 95th percentile latency for API errors in their production environment over the last hour. They can use this Skill to generate the precise query, ensuring it follows best practices for performance and accuracy.

Quick Start

Use the logql-generator skill to create a LogQL query that counts the number of error logs from the 'api' application over the last 5 minutes.

Frequently Asked Questions about logql-generator

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

FAQPage Schema
How do I write a LogQL query to calculate the 95th percentile latency for API errors in Grafana Loki?

To calculate the 95th percentile latency for API errors in Grafana Loki, you can generate a LogQL metric query using label matchers for the application and line filters for error logs. This ensures the query follows best practices for performance and accuracy.

What is the best way to build complex LogQL queries for Grafana Loki dashboards without deep query language expertise?

Building complex LogQL queries for Grafana Loki dashboards is simplified through interactive planning, which guides requirements gathering and incremental query building. This approach leverages local and external documentation to ensure accuracy without requiring deep query language expertise.

Can I validate generated LogQL queries against current Loki documentation and standards?

Yes, generated LogQL queries are validated against integrated local and external references to ensure they adhere to current LogQL standards and conventions. This validation process guarantees the query's syntax and structure are correct before use.

How do I create a LogQL alerting rule query to count error logs from a specific application over a time range?

To create a LogQL alerting rule query counting error logs from a specific application over a time range, you use label matchers for the application and line filters for errors. This generates a precise query suitable for alerting rule implementation.

Does LogQL support aggregations and metric queries for log analysis in Loki?

Yes, LogQL supports aggregations and metric queries for log analysis in Loki. You can generate queries that include label matchers, line filters, and aggregations to transform log data into metrics for diverse use cases like error analysis.

What are the limitations of using automated LogQL generation for observability tasks?

Automated LogQL generation for observability tasks relies on interactive planning and reference integration, meaning it requires clear user requirements to build queries incrementally. It does not replace the need for understanding underlying log structures for complex error analysis.