An agentic application for analyzing dmesg and opensm logs in AI data centers, generating comprehensive human-readable reports using pydantic-ai.
- Intelligent Log Analysis: Uses AI to understand and categorize log entries
- Automated Pattern Recognition: Generates whitelist rules from example logs
- Multi-format Output: HTML, JSON, and Markdown reports
- Rich Visualizations: Charts and graphs for better insights
- Command-line Interface: Easy-to-use CLI with rich output
- Extensible Architecture: Modular design for easy customization
- Pattern Generation: Scan example logs to create whitelist regex patterns
- Log Filtering: Apply patterns to filter input logs, keeping only essential messages
- Analysis: Analyze filtered logs to identify issues, patterns, and trends
- Visualization: Generate charts and graphs for visual insights
- Report Generation: Create comprehensive reports in multiple formats
# Clone the repository
git clone <repository-url>
cd super_report
# Install dependencies
pip install -e .
# Or install with development dependencies
pip install -e ".[dev]"
Set your OpenAI API key and optionally a custom endpoint:
# Required: API key
export OPENAI_API_KEY="your-api-key-here"
# Optional: Custom OpenAI-compatible endpoint
export OPENAI_BASE_URL="http://localhost:8000/v1"
Super Report supports any OpenAI-compatible API:
- OpenAI:
https://api.openai.com/v1
(default) - Azure OpenAI:
https://your-resource.openai.azure.com/
- Local models:
http://localhost:8000/v1
(vLLM, Ollama, etc.) - Other providers: Any service with OpenAI-compatible API
For enhanced logging and tracing, install with logfire support:
pip install "super-report[logfire]"
Enable logfire in your commands:
super-report analyze /var/log/dmesg --enable-logfire
# Analyze log files
super-report analyze /var/log/dmesg /var/log/opensm.log
# With example files for better pattern generation
super-report analyze /var/log/dmesg -e examples/sample_dmesg.log
# Generate JSON report
super-report analyze /var/log/dmesg --format json --output report.json
# Use different AI model
super-report analyze /var/log/dmesg --model gpt-3.5-turbo
# Use custom OpenAI-compatible endpoint
super-report analyze /var/log/dmesg --base-url http://localhost:8000/v1
# Enable logfire logging
super-report analyze /var/log/dmesg --enable-logfire
# Preview log format
super-report preview /var/log/dmesg --lines 20
# Show examples and usage
super-report examples
# Show help
super-report --help
super-report analyze --help
super_report/
├── super_report/
│ ├── __init__.py # Package initialization
│ ├── models.py # Pydantic data models
│ ├── agent.py # Main agent implementation
│ ├── tools.py # Chart generation and rendering tools
│ └── cli.py # Command-line interface
├── examples/
│ ├── sample_dmesg.log # Example dmesg log
│ └── sample_opensm.log # Example opensm log
├── pyproject.toml # Project configuration
└── README.md # This file
The application uses Pydantic models for type safety and validation:
- LogType: Enum for supported log types (dmesg, opensm)
- LogSeverity: Severity levels (critical, error, warning, info, debug)
- WhitelistRule: Regex patterns for log filtering
- FilteredLogEntry: Processed log entries with metadata
- LogAnalysisResult: Analysis results and insights
- ReportOutput: Final report structure
The main agent orchestrates the analysis through these steps:
- generate_whitelist_rules(): Create filtering patterns from examples
- filter_logs(): Apply patterns to input logs
- analyze_filtered_logs(): Extract insights and identify issues
- generate_charts(): Create visualizations
- render_report(): Generate final report
- Format:
[timestamp] component: message
- Focuses on kernel messages, hardware errors, driver issues
- Format:
timestamp opensm[pid]: message
- Focuses on InfiniBand subnet management, connectivity issues
- Pie Charts: Severity distribution
- Bar Charts: Issues by component
- Timeline Charts: Events over time
- Heatmaps: Pattern analysis
- Interactive charts with Plotly
- Rich styling and formatting
- Executive summary and recommendations
- Detailed analysis sections
- Machine-readable format
- Complete data export
- API integration friendly
- Human-readable text format
- Version control friendly
- Documentation integration
# Install with development dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Format code
black super_report/
isort super_report/
# Type checking
mypy super_report/
- Add new enum value to
LogType
inmodels.py
- Implement detection logic in
agent.py
- Add parsing rules in helper methods
- Update CLI help and examples
- Add new fields to
LogAnalysisResult
model - Implement analysis logic in
analyze_filtered_logs()
- Update report templates in
tools.py
- Add corresponding visualizations
See the examples/
directory for sample log files that demonstrate the supported formats and typical issues found in AI data center environments.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT
For issues and questions:
- Check the examples with
super-report examples
- Preview your log format with
super-report preview
- Review the generated reports for insights
- Open an issue on GitHub for bugs or feature requests