Official Grafana Loki CLI for LogQL queries, live tails, label discovery, index inspection, and delete requests.
Agent Compatibility
JSON Output
Agent Skill
MCP Support
AI Analysis
LogCLI is Grafana's command line client for querying Loki with LogQL and related index APIs. It is built for shell-first log work where you want to inspect, export, or administer log data without opening Grafana.
What It Enables
- Run LogQL range and instant queries, live-tail matching streams, and export logs as raw text or JSONL.
- Inspect label values, series cardinality, detected fields, and index volume to debug queries, label hygiene, and storage cost.
- Download large time windows in parallel, test LogQL against local files with
--stdin, and create, list, or cancel log deletion requests.
Agent Fit
- Flags and
LOKI_*environment variables make unattended auth and repeatable query windows straightforward in scripts or CI. - It maps closely to Loki's HTTP and websocket APIs, so agents can inspect, export, tail, and request deletions from one shell surface.
- Structured output is partial rather than universal: log queries use JSONL, many metadata commands stay text-first, and you still need working Loki credentials or local input data.
Caveats
- It is a query and admin client, not a log ingestion tool.
- Grafana recommends matching the
logcliversion to the Loki server version, and some commands depend on backend features such as TSDB indexes or delete APIs.