Skip to content

grapicli

grapicli is a command-line tool for querying your Graylog server's REST API. It is built with Typer and renders results in a rich terminal table using Rich.

Features

  • 🔍 Search logs by source host, message content, or any combination
  • 🕐 Flexible time ranges — relative (last N minutes) or absolute (from/until)
  • 📋 Configurable result limits
  • 🔑 Token-based authentication via a .env file
  • 🖥️ Rich terminal output with syntax-highlighted tables

Quick start

Install from PyPI into a virtual environment:

python3.14 -m venv .venv
source .venv/bin/activate
pip install grapicli

Set your credentials in a .env file:

export GRAYLOG_URL=https://your-graylog-server
export GRAYLOG_TOKEN=your_api_token_here

Then start searching:

# Last 15 minutes, up to 30 messages
grapicli search

# Filter by source
grapicli search --source myserver

# Filter by message text
grapicli search --message "error" --limit 50

# Absolute time range
grapicli search --since "2026-04-17 08:00:00" --until "2026-04-17 09:00:00"

See the Installation page for full setup details, then the Usage guide for all available options.