😫 Vấn đề (The Pain Point)
Hệ thống phần mềm sinh ra file log nặng 500MB mỗi ngày. Khi có lỗi, bạn mở Notepad lên tìm chữ “Error” thì máy treo.
🚀 Giải pháp Agentic (The Solution)
Tool “Log Parser”: Đọc file text dòng-theo-dòng (không load hết vào RAM), bắt từ khóa lỗi và thống kê.
Tính năng:
- Keyword Filter: Chỉ trích xuất dòng chứa “ERROR”, “CRITICAL”.
- Timeline: Thống kê xem lỗi xảy ra nhiều nhất vào giờ nào (đọc timestamp).
🤖 Engineering Prompt (Copy & Paste)
**Role:** Python System Developer
**Task:** Create a "Log File Analyzer".
**Requirements:**
1. **Tech Stack:** Python, `tkinter`, `pandas`.
2. **GUI:**
* Input Log File (.txt, .log).
* Keywords (comma separated, e.g., ERROR, WARNING, FAIL).
* "Scan" button.
3. **Logic:**
* Read file line by line (memory efficient).
* If line contains keyword -> Add to list.
* Extract Timestamp if possible (Regex: `\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}`).
* Export results to Excel.
4. **Deliverables:**
* `log_parser.py`
* `run.bat`
* `requirements.txt`
**Context:** IT support troubleshooting server issues.
🧠 Giải mã Prompt
- Line-by-line Reading: Cách đọc file thông minh này giúp tool xử lý được file log nặng hàng GB mà không làm đơ máy tính (khác với việc mở bằng Word/Notepad).
🛠️ Hướng dẫn
- Copy Prompt -> Paste -> Chạy.
- Chọn file Log -> Nhập “ERROR” -> Scan.