An intelligent, modular log monitoring and analysis system with AI-powered error detection and automated solutions
Features • Installation • Usage • Architecture • Configuration • Contributing
- 🤖 Intelligent Error Detection: Automatically detects 15+ error types across multiple programming languages and platforms
- 🔍 AI-Powered Analysis: Provides detailed analysis of errors with context-aware explanations
- 💡 Automated Solutions: Suggests fixes and generates code snippets to resolve issues
- 📧 Email Notifications: Real-time alerts with direct links to error analysis
- 🌐 Web Crawler Integration: Searches for solutions across the web
- 📊 Real-time Dashboard: Live monitoring with beautiful visualizations
- 🧩 Modular Architecture: Plugin-based system for easy extensibility
- 🌍 Multilingual Support: Built-in English and Persian (Farsi) localization
- ⚡ High Performance: Efficient log tailing with minimal resource usage
- 💾 SQLite Database: Lightweight, zero-configuration data storage
- 🎨 Modern UI: Responsive design with gradient animations and glass morphism
- 🔒 Secure: No external dependencies for core functionality
✓ SyntaxError ✓ TypeError ✓ ValueError
✓ AttributeError ✓ NameError ✓ ImportError
✓ IndexError ✓ KeyError ✓ FileNotFoundError
✓ PermissionError ✓ RuntimeError ✓ MemoryError
✓ RecursionError ✓ ZeroDivisionError ✓ HTTP Errors (404, 500, 403)
✓ DatabaseError ✓ ConnectionError ✓ TimeoutError
- Python 3.8 or higher
- pip (Python package manager)
- Modern web browser (Chrome, Firefox, Safari, Edge)
- Clone the repository
git clone https://github.com/PicoBaz/PyLoPi.git
cd PyLoPi- Create virtual environment (recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies
pip install -r requirements.txt- Run the application
python app.py- Open your browser
http://localhost:5000
- Start the application
python app.py-
Configure log paths
- Navigate to the Dashboard
- Add log file paths you want to monitor
- Click "Start Monitoring"
-
View analysis
- Errors appear in real-time on the dashboard
- Click "View Details" for full analysis
- Get automated solutions and code fixes
- Go to Settings tab
- Enable email notifications
- Configure SMTP settings:
{
"email_notifications": true,
"email_address": "[email protected]",
"smtp_server": "smtp.gmail.com",
"smtp_port": 587,
"smtp_username": "[email protected]",
"smtp_password": "your-app-password"
}Select which error types to monitor:
- Navigate to Settings
- Check/uncheck error types
- Click "Save Settings"
PyLoPi works with various log formats:
Python Applications
import logging
logging.basicConfig(filename='app.log', level=logging.ERROR)Web Servers (Apache/Nginx)
ErrorLog /var/log/apache2/error.log
Custom Applications
- Any text-based log file
- Supports UTF-8 encoding
- Real-time tailing
pylopi/
├── app.py # Main Flask application
├── database.py # Database manager
├── log_analyzer.py # Core analysis engine
├── email_notifier.py # Email notification system
├── config_manager.py # Configuration handler
├── requirements.txt # Python dependencies
├── config.json # User configuration (auto-generated)
├── pylopi.db # SQLite database (auto-generated)
├── templates/
│ └── index.html # Web interface
└── README.md # This file
graph LR
A[Log Files] --> B[Log Analyzer]
B --> C[Error Detection]
C --> D[Web Crawler]
D --> E[Solution Generation]
E --> F[Database]
F --> G[Web Dashboard]
E --> H[Email Notifier]
- Real-time log monitoring
- Pattern matching for error detection
- Context-aware analysis
- Solution generation
- SQLite-based storage
- Thread-safe operations
- Efficient querying
- Statistics generation
- HTML email templates
- SMTP integration
- Severity-based alerting
- Direct dashboard links
- JSON-based configuration
- Default settings
- Hot-reload support
- Validation
{
"language": "en",
"email_notifications": false,
"email_address": "",
"smtp_server": "smtp.gmail.com",
"smtp_port": 587,
"smtp_username": "",
"smtp_password": "",
"enabled_error_types": [
"SyntaxError",
"TypeError",
"ValueError",
"AttributeError",
"NameError",
"ImportError",
"IndexError",
"KeyError",
"FileNotFoundError",
"404Error",
"500Error",
"DatabaseError",
"ConnectionError"
],
"log_retention_days": 30,
"max_logs_per_file": 10000,
"monitoring_interval": 2
}You can also use environment variables:
export PYLOPI_SMTP_USERNAME="[email protected]"
export PYLOPI_SMTP_PASSWORD="your-app-password"
export PYLOPI_PORT=5000Edit log_analyzer.py:
self.error_patterns = {
'CustomError': r'CustomError:(.+)',
# Add your pattern here
}Create a new file custom_analyzer.py:
class CustomAnalyzer:
def analyze(self, log_line):
# Your custom logic
return analysis_resultEdit the translations object in templates/index.html:
const translations = {
es: {
title: "PyLoPi",
subtitle: "Monitor y Análisis Inteligente de Logs",
// Add more translations
}
};| Endpoint | Method | Description |
|---|---|---|
/api/config |
GET | Get current configuration |
/api/config |
POST | Update configuration |
/api/start-monitoring |
POST | Start log monitoring |
/api/stop-monitoring |
POST | Stop log monitoring |
/api/logs |
GET | Get recent logs |
/api/log/<id> |
GET | Get log details |
/api/stats |
GET | Get statistics |
/api/language |
POST | Set interface language |
import requests
response = requests.post('http://localhost:5000/api/start-monitoring',
json={'log_paths': ['/var/log/app.log']})
logs = requests.get('http://localhost:5000/api/logs?limit=10').json()- Live Statistics: Total logs, today's count, critical errors
- Recent Logs: Latest errors with quick preview
- Monitoring Control: Start/stop monitoring interface
- Log Path Management: Add/remove paths dynamically
- Filterable List: All logged errors
- Severity Indicators: Color-coded badges
- Quick Access: Direct links to full analysis
- Full Analysis: Complete error breakdown
- Solution Steps: Step-by-step fix instructions
- Code Snippets: Ready-to-use code fixes
- Full Log Context: Original log entry
- Email Configuration: SMTP setup
- Error Filters: Choose which errors to track
- Language Selection: Switch between English/Persian
- Preferences: Customize monitoring behavior
# Create a test log file
echo "TypeError: unsupported operand type(s)" >> test.log
# Start PyLoPi and add test.log
# Error should appear in dashboardpython -m pytest tests/Port already in use
# Change port in app.py
app.run(debug=True, host='0.0.0.0', port=5001)Email notifications not working
- Enable "Less secure app access" for Gmail
- Use app-specific password for Gmail
- Check SMTP settings
Logs not appearing
- Verify file path is correct
- Check file permissions
- Ensure log file exists
Database locked error
- Close other connections to pylopi.db
- Restart the application
We welcome contributions! Here's how:
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature
- Commit your changes
git commit -m 'Add amazing feature' - Push to the branch
git push origin feature/amazing-feature
- Open a Pull Request
- Follow PEP 8 style guide
- Add docstrings to functions
- Update README for new features
- Test thoroughly before submitting
- Mehdi - Initial work - PicoBaz
- Flask framework for the web interface
- BeautifulSoup for web crawling
- SQLite for reliable data storage
- The open-source community
- Email: [email protected]
Made with ❤️ by developers, for developers