LogAgent is an advanced real-time system monitoring platform with AI-powered root cause analysis. The system provides comprehensive insights into system performance, logs, and code changes while leveraging artificial intelligence to automatically identify potential issues and their underlying causes.
- Live System Telemetry: Real-time collection of system logs, performance metrics, and application data
- Interactive Dashboard: Web-based interface with real-time data visualization and metrics
- Multi-Source Data Integration: Unified monitoring of logs, system metrics, and code repository changes
- Comprehensive Root Cause Analysis: AI agent that analyzes multiple data sources simultaneously
- Multi-Tool Analysis: Uses specialized analyzers for logs, metrics, and commits
- FastAPI: High-performance Python web framework for API development
- MongoDB: NoSQL database for storing logs, metrics, and commit data
- PyMongo: Official MongoDB driver for Python
- React: Modern JavaScript framework with hooks and functional components
- Recharts: Interactive data visualization library for metrics and analytics
- Lucide React: Modern icon library for UI components
- LangChain: Framework for building AI agent workflows
- Google Gemini 2.5 Flash: Large language model for natural language processing
- Custom AI Tools: Specialized analyzers for different data types
- Python 3.10 or higher
- Node.js 18 or higher
- npm or yarn package manager
- MongoDB 4.4 or higher (local installation or MongoDB Atlas)
git clone https://github.com/HarshitR2004/LogAgent.git
cd LogAgent- Install MongoDB Community Edition from MongoDB Downloads
- Start the MongoDB service:
# On Windows (as Administrator) net start MongoDB # On macOS/Linux sudo systemctl start mongod
- Ensure MongoDB is running on the default port
27017
- Create a free account at MongoDB Atlas
- Create a new cluster and get the connection string
- Update the MongoDB connection string in
Backend/Services/MongoClient.pyif using a custom connection
pip install -r requirements.txtcd frontend
npm installCreate a .env file in the root directory with your API keys:
GOOGLE_API_KEY=your_gemini_api_key_here
# Optional: Custom MongoDB connection string
# MONGODB_URI=your_mongodb_connection_string_hereRun the data migration script to set up the database structure:
python migrate_data.pycd Backend
uvicorn main:app --reload --port 8000In a new terminal:
cd frontend
npm run dev- Launch Backend: Start the FastAPI server to begin data collection
- Open Dashboard: Access the web interface at
http://localhost:5173 - Start Monitoring: Click "Start Monitoring" to begin real-time data collection
- Real-Time Logs: View system logs with filtering capabilities
- Performance Metrics: Monitor CPU, memory usage, and system performance
- Repository Analysis: Track code commits and changes
- AI Analysis: Trigger comprehensive root cause analysis
- Data Collection: System continuously collects logs, metrics, and repository data
- Trigger: Use "Run Root Cause Analysis" button to start AI analysis
- Multi-Tool Processing: AI agent uses specialized analysis tools:
- Log Analysis Tool
- Metrics Analysis Tool
- Commits Analysis Tool
- Comprehensive Report: Receive detailed analysis with root cause identification
- MongoDB Client: Centralized database operations for all data storage and retrieval
- Log Filter: Processes and categorizes log entries, stores in MongoDB
- Metrics Collector: Gathers system performance data, persists to MongoDB
- Event Detection: Identifies significant system events
- Commits Collector: Analyzes repository changes, stores commit data in MongoDB
- MongoDB Collections:
- logs: System logs with filtering and categorization
- metrics: Performance metrics and system telemetry
- commits: Repository commit history and code changes
- Indexed Collections: Optimized database queries for real-time performance
- Agent Controller: Orchestrates multi-tool analysis workflow
- Specialized Analyzers:
- Logs Analyzer: Identifies error patterns and system issues
- Metrics Analyzer: Analyzes performance trends and anomalies
- Commits Analyzer: Correlates code changes with system issues
- Modern React Architecture: Component-based architecture with hooks and context
- Real-time Updates: Live data streaming and automatic refresh capabilities
- Interactive Charts: Dynamic metrics visualization using Recharts library
- Collection: Multiple collectors gather data from various sources
- Storage: All data is stored in MongoDB collections with proper indexing
- Processing: Data is filtered, categorized, and structured in the database
- Retrieval: Frontend and AI components query MongoDB for real-time data
- Analysis: AI agent processes all data sources for root cause analysis
- Visualization: Results displayed in interactive React components with modern UI
LogAgent uses MongoDB to store all monitoring data including logs, metrics, and commit information. The system creates three main collections:
- logs: Stores system logs with timestamp, level, user info, and messages
- metrics: Contains system performance data (CPU, memory usage, etc.)
- commits: Repository commit history with file changes and metadata
The MongoDB client can be configured in Backend/Services/MongoClient.py:
- Connection String: Default is
mongodb://localhost:27017/ - Database Name: Default is
logagent - Collections: Automatically created with proper indexing
- Connection Issues: Ensure MongoDB is running and accessible
- Performance: The system creates indexes automatically for optimal query performance
- Storage: Monitor disk space as logs and metrics can grow over time
- Migration: Use the provided migration script to initialize or transfer data