A set of rich, polished command-line tools for visualizing and analyzing LLMgine event logs.
- Interactive Log Viewer: Navigate and filter log events with a rich terminal UI
- Log Statistics: Generate and visualize statistics from log files
- Log Search: Find events using various search criteria
- Trace Visualization: Visualize event timelines and tool call graphs
- Unified CLI: Single entry point for all observability tools
The tools are included as part of the LLMgine project. No additional installation is required beyond the standard LLMgine dependencies.
Make sure you have the rich library installed:
pip install rich
The logcli.py script provides a unified interface to all the tools:
python -m programs.observability-cli.logcli [command] [options]
Available commands:
list: List available log filesview [LOG_FILE]: Open interactive log viewerstats [LOG_FILE]: Show statistics for a log filesearch [LOG_FILE] [OPTIONS]: Search for events in a log filetrace [LOG_FILE] [OPTIONS]: Visualize event traces
For example:
python -m programs.observability-cli.logcli list
python -m programs.observability-cli.logcli view logs/events_20250420_170615.jsonl
python -m programs.observability-cli.logcli stats logs/events_20250420_170615.jsonl --summary
python -m programs.observability-cli.log_viewer [LOG_FILE]
Options:
--listor-l: List available log files--sessionor-s: Filter by session ID--typeor-t: Filter by event type--eventor-e: Show details for event ID--timeline: Show timeline view
In the interactive mode, you'll see a command prompt where you can enter commands:
llmgine-logs> help
Available commands:
help,h: Show help informationview [PAGE],v: View events (optionally specify page number)next,n: Go to next pageprev,p: Go to previous pagefilter <NAME> <VALUE>,f: Filter events (e.g.,filter session_id UBWJK)clear,c: Clear all filterssessions,s: List available sessionstypes,t: List event typesdetail <EVENT_ID>,d: Show event detailstimeline [SESSION_ID],l: Show event timelinestats,st: Show log statisticsquit,q: Exit the viewer
The prompt shows active filters:
llmgine-logs[session_id=UBWJK]>
python -m programs.observability-cli.log_stats [LOG_FILE]
Options:
--summaryor-s: Print summary only--eventsor-e: Print event type distribution--sessionsor-S: Print session statistics--timeor-t: Print time series analysis--sequencesor-q: Print common event sequences
python -m programs.observability-cli.log_search [LOG_FILE] [OPTIONS]
Options:
--idor-i: Search by event ID pattern--sessionor-s: Search by session ID--typeor-t: Search by event type--start-time: Search from this time (ISO format)--end-time: Search until this time (ISO format)--patternor-p: Search by content pattern (regex)--fieldor-f: Specific field to search in--format: Output format (table, json, compact)--contextor-c: Show context around matching events--context-lines: Number of context lines (default: 5)
python -m programs.observability-cli.traceviz [LOG_FILE] [OPTIONS]
Options:
--listor-l: List available sessions--sessionor-s: Session ID to visualize--eventor-e: Show details for event ID
- View an interactive visualization of a log file:
python -m programs.observability-cli.log_viewer logs/events_20250420_170615.jsonl
- Generate statistics for a log file:
python -m programs.observability-cli.log_stats logs/events_20250420_170615.jsonl
- Search for specific events:
python -m programs.observability-cli.log_search logs/events_20250420_170615.jsonl --type ToolCalledEvent --format json
- Visualize traces for a specific session:
python -m programs.observability-cli.traceviz logs/events_20250420_170615.jsonl --session UBWJK
- Using the unified CLI:
python -m programs.observability-cli.logcli trace logs/events_20250420_170615.jsonl --session UBWJK
- Robust JSON Parsing: Handles multi-line JSON objects in log files, with fallback repair mechanisms
- Pagination: View large log files with next/previous page navigation
- Flexible Filtering: Filter events by session ID, event type, event ID, and timestamp
- Rich Visualizations: Colorized event types, syntax highlighting, and tree-based timeline views
- Command Completion: Tab completion for commands and common values (in interactive mode)
- Statistics: Event type distribution, session statistics, and time series analysis
- Command Line Interface: Uses a simple text-based command prompt for maximum reliability
- Modular Architecture: Separate tools for viewing, searching, and analyzing logs
- Unified Entry Point: Single CLI that dispatches to appropriate tools
- Robust Error Handling: Graceful handling of malformed log entries and user input
- Built with the Rich library for attractive terminal output
- Event-driven approach to match LLMgine's architecture
- Clear separation between data processing and presentation
- Compatible with all LLMgine log formats and event types