A Python CLI tool for analyzing logs using the GitHub Copilot SDK.
- 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
python -m logpilot.cli [--version] analyze <path> [OPTIONS]--version: Show the current logpilot version and exit
<path>: Path to a log file or directory (any extension)
--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)
Summarize a log file and print to terminal:
python -m logpilot.cli analyze mylog.txtSummarize all logs in a directory (combined analysis):
python -m logpilot.cli analyze ./logsSummarize 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.txtAnalyze logs with a different model:
python -m logpilot.cli analyze mylog.txt --model gpt-3.5-turbologpilot/- Core modulestests/- Unit tests
- 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
logpilot works on Windows, macOS, and Linux platforms where Python 3.9+ is available.
- Clone the repo
- Install dependencies:
pip install -r requirements.txt - (Recommended) Install dev dependencies:
pip install -r requirements-dev.txt - Authenticate with Copilot SDK as per GitHub's instructions
MIT