Skip to content
Back to skills

Grafana Loki Logcli

BSecurity

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

  • 755 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added February 8, 2026
toolsbashapi

Works with

  • cli
  • api

Security analysis

B88/100
  • criticalSends environment variables or credentials to an external URL

Pro shows the line behind each finding and how to fix it

Scanned February 12, 2026

npx -y skills add majiayu000/claude-skill-registry --skill grafana-loki-logcli --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Grafana Loki Logcli?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Grafana Loki Logcli
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-grafana-loki-logcli/badge)](https://www.skillsdirectory.com/skills/majiayu000-grafana-loki-logcli)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: grafana-loki-logcli
description: Query and explore logs in Grafana Loki via the logcli command-line tool. Use when a user asks to pull logs for analysis.
allowed-tools: Bash(logcli:*)
---

# 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/

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in tools →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.