Real-time Kubernetes log analysis with GitHub Copilot Claude Sonnet 4 Agent integration.
python startup_script.pyEnter your VM details when prompted.
Use this prompt in GitHub Copilot to start debugging without running any scripts manually:
# 🚨 MCP Microservice Debug Setup
I need you to set up and run a microservice debugging system with these specs:
**System Requirements:**
- Monitor Kubernetes pod logs in real-time
- Detect: Java exceptions, OutOfMemory, SIGKILL, SIGTERM, database/kafka errors
- Parse JSON logs and group by thread ID for context analysis
- Generate debugging contexts automatically
**Connection Details:**
- VM IP: [YOUR_VM_IP]
- Username: [YOUR_USERNAME]
- PEM Key: ./NxF-2.pem
- Pod: onc-[SERVICE_NAME]-service-0
- Namespace: onc
- Command: `kubectl logs -f onc-[SERVICE_NAME]-service-0 -n onc`
**Expected Log Format:**
```json
{
"timestamp":"2025-09-08T11:14:10.544Z",
"service":"inventory",
"level":"error",
"message":"Error message here",
"thread":"devicenotifications_updates_5_1417"
}Setup Instructions:
- Install required packages:
mcp,paramiko - Create MCP server configuration for GitHub Copilot
- Start secure SSH connection using PEM key (no password storage)
- Begin real-time log monitoring
- Parse JSON logs and extract thread context
- Detect error patterns and group related logs
- Generate Copilot contexts with root cause analysis
- Provide specific fix suggestions
When errors are detected:
- Group last 5 logs from same thread for context
- Analyze cascading failures
- Generate root cause analysis with confidence scores
- Create actionable fix suggestions
- Save context files:
copilot_context_*.jsonandcopilot_prompt_*.md
Please start the debugging system now and begin monitoring my microservice.
Replace [YOUR_VM_IP], [YOUR_USERNAME], and [SERVICE_NAME] with your actual values.
## 🎯 What It Does
- **Connects securely** via SSH with your PEM key
- **Monitors logs** for errors and exceptions
- **Groups related logs** by thread ID for better context
- **Generates analysis** with root causes and fix suggestions
- **Creates Copilot contexts** automatically for debugging assistance
## 📁 Files Needed
your-project/ ├── NxF-2.pem # Your PEM key file ├── startup_script.py # Main launcher ├── mcp_debug_server.py # MCP server code └── simple_debug_client.py # Lightweight option
## 🔧 Error Detection
Automatically detects:
- Java exceptions and stack traces
- OutOfMemoryError conditions
- SIGKILL/SIGTERM signals
- Database connection issues
- Kafka messaging problems
- Network connectivity errors
## 🤖 GitHub Copilot Commands
Once running, use these commands:
@microservice-debugger start_debug_session with vm_ip="192.168.1.100" username="admin" pem_file_path="./NxF-2.pem" pod_name="onc-inventory-service-0" namespace="onc"
@microservice-debugger get_latest_errors with count=3
@microservice-debugger stop_debug_session
## 🚨 Quick Start Prompts
**Interactive Setup (Claude asks for details):**
```markdown
@microservice-debugger I need microservice debugging setup. Please ask me for my VM IP, username, and service name, then automatically start the monitoring system.
Direct Setup (provide details immediately):
@microservice-debugger Setup debugging: VM=192.168.1.100, user=admin, service=onc-inventory-service-0, namespace=onc, key=./NxF-2.pem. Start monitoring now.That's it! The system handles security, connects via PEM key, analyzes logs intelligently, and provides debugging contexts for GitHub Copilot automatically.