Skip to content
grafana-loki-logcli logo

Grafana Loki LogCLI

grafana-loki-logcli

Query and explore logs in Grafana Loki via the logcli command-line tool. Use when a user asks to pull logs for analysis.

SKILL.md

Full skill instructions

Grafana Loki LogCLI

The logcli is a command-line client for Grafana Loki that runs LogQL queries against a Loki instance.

Requirements: The logcli CLI must be pre-installed on the computer.

Instructions

When running "logcli query" always use -z UTC to request the UTC timezone of the output.

Pass the --output raw unless the use case requires jsonl.

When a user refers to a date or a range of dates, use the 2021-01-19T10:00:00Z format to pass the CLI. Always assume the time is UTC unless specified explicitly.

To request all available log entries pass the --limit 0. Consider pipe'ing or tee'ing the output to a temporal text file to run the analysis on the fetched data offline.

Examples

Run a LogQL query against the ops Loki instance:

logcli --addr=https://logs-ops-002.grafana-ops.net \
  --username=29 --password=`cat $HOME/​.config/​gcom/​gcom-ops.token` \
  query '<query>'

The username "29" is the well-known "ops tenant". The API password for the tenant seats in the mentioned file.

Use the "ops" instance to pull logs for all non-dev workloads.

Run a LogQL query against the dev Loki instance:

logcli --addr=https://logs-dev-005.grafana-dev.net \
  --username=29 --password=`cat $HOME/​.config/​gcom/​gcom-dev.token` \
  query '<query>'

Query all "info" level logs from the "compactor" container in the namespace "mimir-dev-14" between 8/​10 00:00 and 9/​10 00:00 (not inclusive). Request the output in the jsonl format:

logcli --addr=https://logs-dev-005.grafana-dev.net \
  --username=29 --password=$(cat $HOME/​.config/​gcom/​gcom-dev.token) \
  query '{namespace="mimir-dev-14", container="compactor"} |= `level=info`' \
  --from '2025-10-08T00:00:00Z' --to '2025-10-09T00:00:00Z' -z UTC -o jsonl --limit 0

Reference

Run logcli help to read the reference. Running logcli help <command> shows the reference for a specific sub-command.

The complete online reference is available at https://grafana.com/docs/loki/latest/query/logcli/getting-started/

More Other skills

Delegate independent tasks to specialized agents working concurrently with isolated context.

295.4K 206.3K
View

Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.

179.7K 100.1K
View

Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.

179.7K 89.5K
View

A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).

179.7K 76.1K
View

Fundamental design principles for writing maintainable, testable Python code.

40.2K 21.9K
View

Modern responsive layouts using container queries, fluid typography, CSS Grid, and mobile-first strategies.

40.2K 20K
View

Generate Playwright tests from scenarios using interactive browser exploration and validation.

39.7K 18.2K
View

Modern React state management with Redux Toolkit, Zustand, Jotai, and React Query for every state category.

40.2K 14.7K
View

GDPR-compliant data handling with consent management, data subject rights, and privacy controls.

40.2K 14.3K
View

Python error handling patterns including input validation, exception hierarchies, and partial failure handling. Use when implementing validation logic, designing exception strategies, handling batch processing failures, or building robust APIs.

40.2K 13.5K
View

Detailed multi-file refactor planning with safety checks and rollback guidance.

39.7K 13K
View