ayeeshailyas/Log-Analyzer

GitHub: ayeeshailyas/Log-Analyzer

Stars: 0 | Forks: 0

# Server Log Generation & Analysis Pipeline A lightweight, zero-dependency Python utility designed to generate test log streams with real-world infrastructure anomalies, and parse them through a robust terminal dashboard analyzer. This project demonstrates handling graceful degradation, token isolation, and anomaly reporting without dropping pipeline processing speeds or crashing on malformed input data. ## 🚀 Core Features * **Log Generator (`generate_logs.py`):** Dynamically provisions mock server logs containing a controlled ~7% malformed data rate (including broken timestamps, legacy structures, missing parameters, stack trace blocks, and inline raw JSON objects). * **Log Analyzer Dashboard (`analyzer.py`):** Streams log data line-by-line using low-overhead token validation, ensuring robust execution even when structural schemas completely fail midway. * **Granular Visibility:** Tracks standard response metadata ($2xx$, $4xx$, $5xx$ status distribution, average processing latencies) alongside itemized error-reason counters for corrupted logs. ## 🛠️ Getting Started & Installation This pipeline operates entirely on standard Python utilities. No external dependencies or `pip install` setups are required. ### Prerequisites * Python 3.6 or higher installed on your local environment. ### 1. Provision Test Log Data Generate a mock log file matching real-world failure configurations, running the below script outputs a file named sample_server.log containing 1,000 mixed-integrity log records. python generate_logs.py 2. Run the Summary Dashboard Analyze the log file and generate a terminal metrics visualization: python analyzer.py sample_server.log 📊 Dashboard Visual Output Example When executed successfully, the terminal dashboard prints structured, human-readable insight breakdowns like the following: ================================================== 📊 SERVER LOG ANALYZER DASHBOARD ================================================== Target Log File: sample_server.log Total Lines Scanned: 1,000 Valid Lines Parsed: 932 Malformed Lines: 68 (6.80%) -------------------------------------------------- 📈 TRAFFIC & PERFORMANCE METRICS • Successful (2xx): 412 • Client Errors (4xx): 245 • Server Errors (5xx): 275 • Avg Latency: 241.14 ms -------------------------------------------------- ⚠️ MALFORMED DATA & ANOMALY BREAKDOWN • [12 occurrences] -> Blank line • [18 occurrences] -> Missing or invalid status code ('-') • [21 occurrences] -> Stack trace / Runtime exception snippet • [17 occurrences] -> Unparseable response time unit ('0.142s') ================================================== 📂 Project Architecture ├── generate_logs.py # Mock log simulator engine ├── analyzer.py # Stream token parser and metric calculator ├── ANSWERS.md # Detailed fellowship architectural questionnaire responses └── README.md # Project initialization documentation