Skip to content

About

Copilot-powered CLI for analyzing, summarizing, and explaining logs.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

logpilot 🪵

Python Version License: MIT Code style: black Linter: ruff Security: ruff

A Python CLI tool for analyzing logs using the GitHub Copilot SDK.

Features

  • Accepts logs from a single file or a directory (combined analysis)
  • Supports plain text and JSON log formats
  • Accurate token counting via tiktoken (cl100k_base / GPT-4 compatible), with a character-based fallback
  • Large logs chunked automatically to stay within the model's context window
  • Uses Copilot SDK for LLM-powered analysis

Usage (MVP)

python -m logpilot.cli [--version] analyze <path> [OPTIONS]

Global Options

  • --version : Show the current logpilot version and exit

Arguments

  • <path>: Path to a log file or directory (any extension)

Options

  • --format [auto|json|text] : Log format (default: auto)
  • --output [text|json] : Output type (default: text)
  • --max-tokens <int> : Max tokens per chunk (default: 2048). Token counts are measured using tiktoken (cl100k_base encoding). Increase this value for larger context windows or decrease it to stay within tighter model limits.
  • --out-file <path> : Write output to file (default: stdout)
  • --recursive : Recurse into subdirectories (directory mode)
  • --include <glob> : Glob pattern(s) to include (repeatable)
  • --exclude <glob> : Glob pattern(s) to exclude (repeatable)
  • --model <model> : LLM model to use (default: gpt-4)

Example

Summarize a log file and print to terminal:

python -m logpilot.cli analyze mylog.txt

Summarize all logs in a directory (combined analysis):

python -m logpilot.cli analyze ./logs

Summarize logs in a directory recursively with filters:

python -m logpilot.cli analyze ./logs --recursive --include "*.log" --exclude "archive/*"

Summarize a log file and write to a file:

python -m logpilot.cli analyze mylog.txt --out-file summary.txt

Analyze logs with a different model:

python -m logpilot.cli analyze mylog.txt --model gpt-3.5-turbo

Project Structure

  • logpilot/ - Core modules
  • tests/ - Unit tests

Requirements

  • Python 3.9+
  • Typer — CLI framework
  • rich — terminal output formatting
  • tiktoken — accurate token counting (cl100k_base)
  • tqdm — progress bars
  • orjson — fast JSON parsing
  • toml — TOML config parsing (Python < 3.11 fallback)
  • GitHub Copilot SDK

Supported Platforms

logpilot works on Windows, macOS, and Linux platforms where Python 3.9+ is available.

Setup

  1. Clone the repo
  2. Install dependencies: pip install -r requirements.txt
  3. (Recommended) Install dev dependencies: pip install -r requirements-dev.txt
  4. Authenticate with Copilot SDK as per GitHub's instructions

License

MIT

About

Copilot-powered CLI for analyzing, summarizing, and explaining logs.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages