Skip to content

kumariluckyraj/LogWatch-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

68 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ AI-Powered System Reliability Platform

An intelligent, self-healing platform designed for real-time system reliability and safe deployments. This project leverages AI to monitor, analyze, and automatically respond to system failures β€” ensuring resilience, stability, and minimal downtime.

🌟 Overview

Modern distributed systems are complex and prone to failures. This platform combines:

Intelligent traffic routing RAG-based log analysis Autonomous AI agents

to proactively detect issues and take corrective actions such as instant rollback or recovery, enabling self-healing systems.

βš™οΈ Key Features

πŸ”„ Real-Time Traffic Routing Dynamically routes traffic between stable and test backends Enables safe deployments (canary / blue-green strategies)

🧠 RAG-Based Log Analysis

Uses Retrieval-Augmented Generation (RAG) to: Analyze logs in real time Identify anomalies and failure patterns Provide contextual insights

πŸ€– Autonomous AI Agents

AI agents continuously monitor system health Detect failures without manual intervention Trigger automated recovery workflows

⚑Instant Rollback & Recovery

Automatically rolls back to stable versions on failure detection Minimizes downtime and user impact

πŸ“Š Observability & Monitoring

Track: Request trends Error rates Backend health Traffic distribution

Setup.

# Install dependencies in each folder
cd proxy && npm install
cd ../backend-stable && npm install
cd ../backend-test && npm install

Running with Docker (Recommended)

To run the entire system (all backends, proxy, and dashboard) with a single command:

docker-compose up --build

This will start all 4 services and map them to your host machine.

Warning

Configuration Note for Docker: Since Docker runs services in their own network, 127.0.0.1 inside the Proxy container will point to itself, not the backend containers. For local testing with Docker, you will need to change proxy/config.json to point to http://backend-stable:5001 and http://backend-test:5002 instead of http://127.0.0.1:5001.


Running the System (Manual)

Start in 3 separate terminals:

Terminal 1 - Proxy

cd proxy
npm start

Runs on port 4000

Terminal 2 - Stable Backend

cd backend-stable
npm start

Runs on port 5001 (0% failure rate)

Terminal 3 - Test Backend

cd backend-test
npm start

Runs on port 5002 (40% failure rate)

Testing

Test 1: Check System Status

curl http://127.0.0.1:4000/api/stats

Test 2: Make Requests (Stable Mode)

for i in {1..5}; do
  curl http://127.0.0.1:4000/api
  sleep 0.2
done

Test 3: View Logs

curl http://127.0.0.1:4000/api/logs

Test 4: Trigger Auto-Rollback

  1. Edit proxy/config.json: change "mode": "stable" to "mode": "test"
  2. Make 50 requests:
for i in {1..50}; do
  curl http://127.0.0.1:4000/api 2>/dev/null
  sleep 0.1
done
  1. Watch Terminal 1 for auto-rollback message
  2. Check config was auto-updated: curl http://127.0.0.1:4000/api/config

Test 5: Check Rollback History

curl http://127.0.0.1:4000/api/rollback-history

Configuration

Edit proxy/config.json:

{
  "mode": "stable",           // stable, test, or canary
  "stable_url": "http://127.0.0.1:5001",
  "test_url": "http://127.0.0.1:5002",
  "canary_percent": 10        // % of traffic to test in canary mode
}

API Endpoints

Method Endpoint Description
GET /api/stats Current error rate and metrics
GET /api/logs Today's request logs
GET /api/config Current configuration
POST /api/config Change mode (send {"mode":"stable"})
GET /api/health System health status
GET /api/rollback-history Past rollback events
POST /api/rollback Manual rollback trigger
POST /api/reset-stats Reset statistics

Modes

Stable - All traffic to production backend (port 5001) Test - All traffic to test backend (port 5002, 40% failures) Canary - 90% to stable, 10% to test (configurable percentage)

Auto-Rollback

System automatically switches to stable mode when error rate exceeds 20%.

Threshold can be changed in proxy/server.js:

const autoRollback = new AutoRollback(20);  // Change 20 to desired threshold
## Features
  • Real-time error rate tracking (last 100 requests)
  • Automatic failover when errors exceed threshold
  • JSON-based request logging with daily rotation
  • RESTful API for monitoring and control
  • Professional logging with [INFO], [ERROR], [SUCCESS], [ALERT] tags

Files

  • proxy/server.js - Main proxy server
  • proxy/enhanced-logger.js - Request logging system
  • proxy/error-tracker.js - Error rate tracking
  • proxy/auto-rollback.js - Automatic failover logic
  • proxy/config.json - Configuration file
  • backend-stable/server.js - Stable backend
  • backend-test/server.js - Test backend

🀝 Contributing

We welcome contributions from developers of all skill levels! Whether you're fixing bugs, improving documentation, or adding features β€” your help is appreciated πŸš€

πŸ†• Adding New Features / Modules

Fork the repository

Create a new branch:

git checkout -b feature/your-feature-name Implement your feature Ensure everything works as expected

Commit your changes:

git commit -m "Add: short description of feature" Push to your fork and open a Pull Request

πŸ› Bug Fixes & Improvements

Fork the repository Create a branch: git checkout -b fix/issue-name Fix the issue Test thoroughly Submit a Pull Request with a clear description

🧠 AI / Log Analysis Contributions

You can also contribute by improving the AI capabilities of the platform: Enhance RAG pipelines Improve log parsing & anomaly detection Optimize AI agent decision-making Add new recovery or rollback strategies

πŸ“ Documentation Contributions

-Good documentation is just as important as code!

-Improve README clarity

-Add architecture explanations

-Fix typos or formatting

-Provide setup or deployment guides

πŸ“‹ Contribution Guidelines

-Follow the existing project structure

-Write clean, readable, and modular code

-Add comments where necessary

-Keep commits meaningful and concise

-Update documentation when required

πŸ§ͺ Testing Guidelines

Before submitting your PR, make sure:

-βœ… The project runs without errors

-βœ… Logs and monitoring features work correctly

-βœ… AI-based detection behaves as expected

-βœ… Rollback/recovery triggers properly

-βœ… No breaking changes are introduced

🌐 Browser & Environment Compatibility

This project includes dashboards and UI components that should work across modern environments.

βœ… Recommended Browsers

-Google Chrome

-Mozilla Firefox

-Microsoft Edge

-Safari

πŸ“± Responsive Testing

Ensure your changes work across:

-Desktop πŸ’»

-Tablet πŸ“±

-Mobile πŸ“²

Helpful tools:

-Chrome DevTools Device Toolbar

-Firefox Responsive Mode

πŸ›  Common Issues

Some problems may arise due to:

-Cached assets

-Browser-specific rendering

-Unsupported APIs

-Extension conflicts

πŸ” Troubleshooting Checklist

If something doesn’t work:

-Hard refresh (Ctrl + Shift + R)

-Clear cache

-Use Incognito mode

-Disable extensions

-Check console for errors

πŸ“Œ Before Submitting a PR

Make sure:

-βœ… Code is tested

-βœ… UI is responsive

-βœ… Features work as intended

-βœ… No console errors

-βœ… Documentation is updated

πŸ†˜ Need Help?

If you have questions, ideas, or run into issues, feel free to reach out:

-πŸ’¬ Discussions: Use GitHub Discussions to ask questions or share ideas

-πŸ› Bug Reports: Open an Issue to report bugs or request features

-πŸ“§ Direct Contact: For any queries, simply create an issue β€” we’ll respond as soon as possible

🌟 Stay Connected

-πŸ’Ό LinkedIn: Kumari Lucky Raj

-πŸ™ GitHub: kumariluckyraj

⭐ Show Your Support

If this project helped you, please consider:

-⭐ Starring this repository

-🍴 Forking it to contribute

-πŸ“’ Sharing it with others

-πŸ’– Following for more amazing projects

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages