observability-loki

Query and analyze Grafana Loki logs using LogQL for incident investigation.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/erwinv2k-TKG/AgentesVSC --skill observability-loki-erwinv2k-tkg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: observability-loki
Source: https://github.com/erwinv2k-TKG/AgentesVSC/tree/main/packs/incidentfox/sre-agent/.claude/skills/observability-loki
Command: npx skills add https://github.com/erwinv2k-TKG/AgentesVSC --skill observability-loki-erwinv2k-tkg

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires httpx, and includes scripts (resource) components.

What problem does it solve? Investigating incidents requires digging through large volumes of distributed logs, and writing correct LogQL queries against Grafana Loki by hand is slow and error-prone. This Skill provides a structured workflow and ready-to-run scripts to explore labels, measure error rates, sample logs, and execute LogQL queries directly from the terminal. ## Core Features & Use Cases - Label Discovery: List available Loki labels and their values to understand what is queryable before writing selectors. - Log Statistics: Compute total log volume, error and warning counts, logs-per-minute, and error rate percentages for any stream selector. - Log Sampling & Raw LogQL: Fetch representative log entries with optional regex filters, or run arbitrary log and metric LogQL queries with custom time ranges. - Use Case: During a production incident, run the statistics script against {app="api"} to confirm an elevated error rate, then sample error logs and correlate entries around the incident timestamp to find the root cause. ## Quick Start Ask the agent to show error statistics and recent error logs for the api application in Loki over the last two hours.

Frequently Asked Questions about observability-loki

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

FAQPage Schema
How do I query Grafana Loki logs with LogQL from the command line?

Use the query_logs.py script with a LogQL string, for example a stream selector with line filters like {app="api"} |= "error". Add --type metric for aggregation queries such as rate(), and --json for machine-readable output.

How do I check error rates for a service in Loki?

Run get_statistics.py with a stream selector like {app="api"} and an optional --lookback window in hours. It reports total logs, error and warning counts, logs per minute, and the error rate percentage, flagging rates above 5 percent.

What LogQL stream selectors and filters does Loki support?

Loki supports exact match, regex match with =~, negation with !=, and line filters such as |= for contains and |~ for regex. You can also parse JSON or logfmt lines and filter on extracted labels, then aggregate with functions like rate and count_over_time.

Does this Loki client support authentication and multi-tenancy?

Yes, the client supports bearer tokens via LOKI_TOKEN, basic auth via LOKI_USER and LOKI_PASSWORD, and multi-tenant org IDs via the LOKI_ORG_ID header. It can also run through a credential proxy using LOKI_BASE_URL with tenant context headers.

Why does my Loki query return no logs?

Empty results usually mean the stream selector matches no label combinations, the time window is wrong, or the line filter is too restrictive. First list available labels and values with list_labels.py, then widen the lookback window or relax the filter.