Python Stack Investigator is a great, real-time log ingestion and incident response dashboard. It goes beyond simple log parsers by analyzing multi-stack production crashes, directly extracting live Docker container telemetry, and offering automated side-by-side code remediations.
"Accelerate Mean Time to Resolution (MTTR) - Ingest multi-language logs, calculate infrastructure health, and patch code instantly."
This tool is intended for educational purposes, DevOps security research, and authorized incident response testing. Always ensure proper authorization before monitoring or attaching to live container streams in production networks.
- Language Detection: Automatically classifies stack traces from Python, JavaScript / Node.js, Java, C++, Rust, and SQL.
- Dynamic Signature Matching: Parses log dumps against an external JSON matrix (
error_database.json) for instant signature classification. - Runtime Anomaly Fallback: Gracefully flags unmapped errors with fallback investigation protocols.
- Docker Engine API: Direct integration using Docker SDK to harvest live container logs.
- Automated Container Scanning: Scans active Docker containers for anomalous traces in real time with a single click.
- Aggregate Health State: Dynamic Plotly gauge chart mapping infrastructure health (0%β100%).
- Severity Classification: Categorizes incidents automatically into
CRITICALorHIGHbased on cascading signatures. - Language Tracking: Dynamic status cards displaying all detected programming languages in the current crash trace.
- Side-by-Side Remediation: Displays buggy implementations alongside AI-generated resolution patches.
- Actionable Advice: Provides detailed recommendation notes to guide developers through manual logic reviews.
- Streamlit Ingestion Sandbox: Clean side-by-side layout for log pasting and live diagnostics.
- Session State Control: Persists harvested Docker telemetry across UI interactions.
Figure 1: Real-time Incident Diagnostics Panel, Infrastructure Health Gauge, and Self-Healing Patch Workbench.
- Python 3.9 or higher
- Docker Engine / Docker Desktop (Running for live telemetry features)
- Linux / macOS / Windows
# Clone the repository
git clone [https://github.com/alihusnain404/Python-Stack-Investigator.git](https://github.com/alihusnain404/Python-Stack-Investigator.git)
# Navigate to the tool's directory
cd Python-Stack-Investigator
# Install Python dependencies
pip install -r requirements.txt
# Create virtual environment
python3 -m venv venv
# Activate virtual environment
source venv/bin/activate # Linux/macOS
# OR
venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
streamlit run stack.py
or
python -m streamlit run stack.py
Open your web browser and navigate to:
http://localhost:8501
# 1. Navigate to the demo sandbox
cd docker-demo
# 2. Build the testing container
docker build -t test-buggy-app .
# 3. Run the container to produce continuous multi-stack crash logs
docker run -d --name live-crash-demo test-buggy-app
How to Test in Dashboard: Go to the Streamlit UI, click
π FETCH LIVE DOCKER LOGS, then clickπ DEPLOY PIPELINE SCANNERto see real-time analysis!
.
βββ stack.py # Core Streamlit Dashboard & Investigator Agent
βββ error_database.json # JSON Knowledge Base mapping signatures to patches
βββ requirements.txt # Python project dependencies
βββ README.md # Project documentation
βββ Icon/ # Banners and UI Screenshots
β βββ Banner.png # Main Header Banner
β βββ Banner2.png # UI Dashboard Screenshot
βββ docker-demo/ # Live Docker container testing sandbox
βββ app_with_error.py # Test script generating multi-language crash traces
βββ docker_telemetry_harvester.py # Docker configuration for testing
You can add new error signatures without modifying the Python source code by editing error_database.json:
{
"YourCustomErrorSignature": {
"language": "Python",
"buggy_code": "def process(val):\n return val.data",
"patched_code": "def process(val):\n return getattr(val, 'data', None)",
"remedy": "Check object attribute existence before accessing."
}
}
Contributions, error signatures, and UI enhancements are welcome!
- Fork the Repository
- Create your Feature Branch (
git checkout -b feature/NewSignature) - Commit your Changes (
git commit -m 'Add support for MemoryLeakException') - Push to the Branch (
git push origin feature/NewSignature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Streamlit - For rapid data application framework
- Plotly - For interactive health charts
- Docker SDK for Python - For container log integration