loki

Query Loki logs with LogQL to troubleshoot cluster and application issues.

1|Updated Apr 6, 2025
One-click install
npx skills add https://github.com/david-driscoll/stargate-command-cluster --skill loki-david-driscoll
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: loki
Source: https://github.com/david-driscoll/stargate-command-cluster/tree/main/.agents/skills/loki
Command: npx skills add https://github.com/david-driscoll/stargate-command-cluster --skill loki-david-driscoll

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires curl, jq, python3, and includes scripts (resource) and references (resource) components.

What problem does it solve?

Loki log querying helps you quickly find the root cause of failures by searching structured Kubernetes and application logs for errors, patterns, and reconciliation issues.

Core Features & Use Cases

  • Port-forward based access: Uses kubectl port-forward to reach Loki when internal gateway routing is unavailable, enabling reliable log access during debugging.
  • LogQL troubleshooting queries: Supports LogQL instant, range, and tail-style queries to investigate pod/service issues, Kubernetes events, and Flux reconciliation problems.
  • Operational helpers: Provides convenient discovery and validation actions like listing labels, finding series, and checking Loki health for fast iteration.

Quick Start

Run kubectl --context <cluster> port-forward -n monitoring svc/loki-headless 3100:3100 & and then set LOKI_URL to http://localhost:3100 before using the logql.sh script to search logs.

Frequently Asked Questions about loki

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

FAQPage Schema
How do I query Loki logs to troubleshoot Kubernetes cluster issues?

Query Loki logs using LogQL with the logql.sh helper to search Kubernetes and application logs for errors, pod issues, and reconciliation failures across namespaces and labels.

How do I access Loki for log search when internal gateway routing is unavailable?

Access Loki for log search by running kubectl port-forward to the monitoring namespace's loki-headless service, then configure the LOKI_URL environment variable to your localhost endpoint.

Can I investigate Flux reconciliation failures by searching Loki logs?

Yes, you can investigate Flux reconciliation failures by running LogQL instant and range queries in Loki to find controller errors and Kubernetes events across targeted namespaces.

What LogQL query types are supported for Kubernetes event debugging?

Supported LogQL query types for Kubernetes event debugging include instant, range, and tail queries, plus label discovery, series finding, and Loki health checks for fast iteration.

Do I need curl and jq installed to run LogQL queries against Loki?

Yes, you need curl and jq installed along with python3, as these dependencies are required to execute the logql.sh helper script and process Loki API responses.

Why is my Loki log search failing after setting the LOKI_URL variable?

Loki log search fails if the kubectl port-forward session to the monitoring namespace's loki-headless service is inactive, preventing the logql.sh helper from reaching the configured LOKI_URL.