A full-stack AI DevOps troubleshooting assistant that analyzes Docker, Nginx, Linux, CI/CD, database, and deployment logs to generate incident summaries, likely root causes, safe debugging commands, resolution checklists, and prevention recommendations.
π Quick Start Β· π§ Architecture Β· π Frontend Β· π API Β· πΈ Screenshots
AI DevOps Incident Assistant is a full-stack AI application built to help junior DevOps engineers and support teams analyze infrastructure and deployment incidents faster.
The application allows users to paste logs or incident notes, select an incident category, and receive a structured troubleshooting report. The backend combines rule-based log pattern detection with Gemini-powered analysis to identify likely causes, supporting evidence, safe debugging commands, resolution steps, and prevention recommendations.
The project focuses on real-world DevOps troubleshooting scenarios such as:
- Nginx reverse proxy failures
- Docker container crashes
- Backend upstream connection errors
- CI/CD deployment issues
- Linux service failures
- Database connection problems
- Suspicious bot/scanner activity
Key Idea: The assistant should guide investigation safely by suggesting read-only diagnostic commands first, rather than jumping directly to risky restart/delete actions.
I built this project to connect my DevOps internship experience with practical AI application development.
During DevOps work, many incidents begin with raw logs such as 502 Bad Gateway, 504 Gateway Timeout, connection refused, container restart loops, Nginx upstream failures, or database connection errors. Reading these logs manually requires experience, context, and systematic debugging.
This project explores how AI can assist with:
- Log interpretation
- Incident classification
- Root cause analysis
- Safe debugging workflows
- Resolution checklists
- Preventive DevOps recommendations
The goal was not to replace DevOps engineers, but to build an AI assistant that helps engineers reason through incidents faster and more safely.
- π§Ύ Paste Docker, Nginx, Linux, CI/CD, database, or deployment logs
- ποΈ Select incident category: Nginx, Docker, CI/CD, Linux, Database, Security, or Unknown
- π Rule-based detection for known log patterns
- π€ Gemini-powered structured incident analysis
- π¨ Severity classification: Low, Medium, High, or Critical
- π§ Likely root cause explanation
- π Evidence extraction from logs
- π‘οΈ Safe debugging commands-first approach
- β Step-by-step resolution checklist
- π Prevention recommendations for monitoring and configuration
- π React frontend for log input and analysis display
- π CORS-enabled FastAPI backend integration
Incident Logs / Notes
β
βΌ
React Frontend Input
β
βΌ
FastAPI /analyze Endpoint
β
ββββΊ Rule-Based Pattern Checker
β βββ 502 / 504 detection
β βββ Connection refused detection
β βββ Nginx resolver issue detection
β βββ Docker restart/crash detection
β βββ MongoDB connection issue detection
β βββ Suspicious scanner path detection
β
βΌ
Gemini Prompt with Guardrails
β
βΌ
Structured Incident Analysis
β
βΌ
Frontend Result Display
| Stage | Component | Purpose |
|---|---|---|
| Log Input | React | Accept logs or incident notes from user |
| Category Selection | React dropdown | Provide incident context such as Nginx, Docker, CI/CD, or Database |
| API Layer | FastAPI | Receive logs and return structured analysis |
| Rule-Based Checks | Custom Python logic | Detect common known patterns before AI analysis |
| AI Analysis | Gemini API | Generate root cause, commands, checklist, and prevention steps |
| Output Display | React | Show rule-based findings and AI incident report |
The backend includes a lightweight rule checker before calling Gemini. This helps detect high-confidence operational patterns.
| Pattern | Possible Meaning |
|---|---|
502 / Bad Gateway |
Upstream container failure, wrong backend host, or port mismatch |
504 / Gateway Timeout |
Slow backend response, timeout issue, or blocked upstream service |
connection refused |
Backend service down, wrong port, or unreachable container |
no resolver defined |
Nginx Docker DNS resolver issue |
404 / not found |
Route mismatch, domain mapping issue, or wrong proxy target |
port is already allocated |
Port conflict with another process/container |
restart, exited, crash |
Container crash or application startup failure |
permission denied |
File permission, volume mount, or privilege issue |
mongo + connection failed |
MongoDB URI, auth, Docker network, or DB availability issue |
.env, .git, wp-login, xmlrpc |
Possible bot/scanner activity |
The React frontend provides a clean interface for testing incident analysis workflows.
- Select incident type
- Paste logs or incident notes
- Load a sample Nginx 502 incident
- Submit logs for AI analysis
- View rule-based findings
- View AI incident summary and severity
- View root cause and evidence
- View safe debugging commands
- View step-by-step resolution checklist
- View prevention recommendations
- Clear input and test another incident
| Method | Endpoint | Purpose |
|---|---|---|
| GET | /health |
Check backend health |
| POST | /analyze |
Analyze DevOps logs and return rule-based + AI findings |
{
"incident_type": "Nginx",
"logs": "connect() failed (111: Connection refused) while connecting to upstream, upstream: \"http://172.18.0.5:3000/\", host: \"example.com\", request: \"GET / HTTP/1.1\", status: 502"
}[
"Detected 502/Bad Gateway pattern: possible upstream container failure, wrong upstream host, or backend port mismatch.",
"Detected connection refused pattern: backend service may be down, not listening on the expected port, or unreachable from Nginx."
]| Layer | Technology |
|---|---|
| Backend | FastAPI, Uvicorn |
| Frontend | React, Vite |
| AI Model | Gemini API |
| Rule Engine | Custom Python pattern checker |
| Environment Management | python-dotenv |
| Data Format | JSON API |
| Language | Python, JavaScript |
AI-DevOps-Incident-Assistant/
β
βββ backend/
β βββ app/
β β βββ main.py # FastAPI routes, CORS, API setup
β β βββ config.py # Environment and Gemini config
β β βββ schemas.py # Pydantic request/response schemas
β β βββ rule_checker.py # Rule-based log pattern detection
β β βββ incident_analyzer.py # Gemini prompt and incident analysis logic
β β
β βββ samples/ # Optional sample incident logs
β βββ requirements.txt
β βββ .env.example
β βββ .gitignore
β
βββ frontend/
β βββ src/
β β βββ App.jsx # React incident analyzer UI
β β βββ App.css # Main styling
β β βββ index.css
β β βββ main.jsx
β β
β βββ package.json
β βββ vite.config.js
β
βββ screenshots/
β βββ backend-health-check.png
β βββ backend-analyze-nginx-502.png
β βββ frontend-input-sample.png
β βββ frontend-rule-findings.png
β βββ frontend-ai-analysis-root-cause.png
β βββ frontend-ai-analysis-commands.png
β
βββ README.md
βββ .gitignore
- Python 3.10+
- Node.js and npm
- Gemini API key
- Git
git clone https://github.com/aadi090204/AI-DevOps-Incident-Assistant.git
cd AI-DevOps-Incident-AssistantGo to the backend folder:
cd backendCreate and activate a virtual environment:
python -m venv venv
venv\Scripts\activateInstall backend dependencies:
pip install -r requirements.txtCreate a .env file inside the backend folder:
GEMINI_API_KEY=your_gemini_api_key_hereStart the FastAPI backend:
uvicorn app.main:app --reloadOpen the backend API docs:
http://127.0.0.1:8000/docs
Open a new terminal and go to the frontend folder:
cd AI-DevOps-Incident-Assistant/frontendInstall frontend dependencies:
npm installStart the React development server:
npm run devOpen the frontend:
http://localhost:5173
connect() failed (111: Connection refused) while connecting to upstream, upstream: "http://172.18.0.5:3000/", host: "example.com", request: "GET / HTTP/1.1", status: 502
container exited with code 1 and keeps restarting. Error: missing required environment variable MONGO_URI. Application failed to start.
2026/06/19 10:22:41 [error] 29#29: *45 no resolver defined to resolve app-backend while sending to client, client: 10.0.0.2, server: example.com, request: GET /, upstream: http://app-backend:3000/
GET /.env 404
GET /.git/config 404
GET /wp-login.php 404
GET /xmlrpc.php 404
Multiple requests from same IP within 2 minutes
While building the project, I had to handle a few practical issues:
- Raw logs can be incomplete, so the AI needs to explain what additional information is required.
- AI-generated troubleshooting can become risky if it suggests destructive commands too early.
- Long incident analysis output cannot always fit in one screenshot.
- Some issues can be detected quickly with simple rules before involving the LLM.
- Frontend and backend integration required CORS configuration for local development.
- Added rule-based checks for common DevOps patterns before Gemini analysis.
- Added strict prompt guardrails to prefer safe read-only debugging commands first.
- Instructed the model not to suggest destructive actions such as volume deletion, database dropping, or Docker pruning unless clearly marked as risky.
- Split screenshots into input, rule findings, root cause analysis, and command/checklist sections.
- Added CORS middleware in FastAPI for React integration.
- Structured the output into consistent sections for easier incident review.
- DevOps incidents become easier to debug when logs are converted into structured reasoning.
- Rule-based detection and LLM analysis can complement each other.
- AI troubleshooting tools need safety constraints to avoid harmful operational advice.
- Nginx and Docker errors often require checking both application state and network configuration.
- Frontend design matters when AI output is long and operationally detailed.
- Incident response tools should provide evidence, not just conclusions.
- Add incident history storage using SQLite or PostgreSQL
- Add downloadable incident report generation
- Add support for uploading
.logand.txtfiles - Add Dockerfile and Docker Compose after local Docker testing
- Add deployment support with environment-based API URLs
- Add Prometheus metrics for request count, latency, and error rate
- Add predefined incident templates for Nginx, Docker, MongoDB, GitHub Actions, and Linux systemd
- Add severity-based triage dashboard
- Add multi-model fallback support
- The
.envfile is ignored by Git and should never be committed. - This tool should not be used with sensitive production logs unless secrets, tokens, passwords, and private IPs are redacted.
- AI-generated debugging suggestions should be reviewed before execution.
- Destructive commands should never be run without approval and backup verification.
This project is for educational and portfolio purposes only. It is an AI-assisted troubleshooting tool and should not be treated as a replacement for professional DevOps incident response. Always review commands before running them in production environments.
Adithya Anil AI Engineer / DevOps Engineer GitHub: aadi090204





