πŸ“„

Log Analyzer

Parse and analyze log files to extract errors, warnings, and usage patterns.

Document ⭐⭐ Intermediate ⏱️ 5 minutes

😫 The Pain Point

Your server generated 10GB of logs. You need to find all ERROR entries, count occurrences, and identify the most common issues. Scrolling through millions of lines is impossible.

πŸš€ Agentic Solution

A Log Parser that filters, aggregates, and summarizes log data.

Key Features:

  • Pattern Matching: Custom regex for your log format.
  • Level Filtering: ERROR, WARNING, INFO, DEBUG.
  • Aggregation: Count by type, time period, source.

βš”οΈ Phase 1: Commander (Quick Fix)

For quick analysis.

Prompt:

β€œI have a log file server.log with format [TIMESTAMP] [LEVEL] Message. Write a Python script to:

  1. Parse: Extract timestamp, level, message.
  2. Filter: Show only ERROR and WARNING entries.
  3. Aggregate: Count by level and by hour.
  4. Output: Save filtered entries to errors.csv and summary to summary.txt.

Handle malformed lines (skip with warning).”

Result: Actionable insights from massive logs.

πŸ—οΈ Phase 2: Architect (Permanent Tool)

Engineering Prompt:

**Role:** Python Tool Developer
**Task:** Create a "Log Analyzer".

**Requirements:**
1.  **GUI:**
    *   Select log file.
    *   Regex pattern builder for custom formats.
    *   Level filter checkboxes.
    *   Time range filter.
    *   Results table with search.
    *   Export options.

2.  **Logic:**
    *   Stream parsing for large files.
    *   Pandas for aggregation.
    *   Matplotlib charts for visualization.

3.  **Deliverables:**
    *   `log_analyzer.py`
    *   `run.bat`, `run.sh`
    *   `requirements.txt`

🧠 Prompt Decoding

  • Stream Parsing: Don’t load entire file into memory. Process line by line.

πŸ› οΈ Instructions

  1. Copy Prompt β†’ Adjust regex for your format β†’ Run.

Related Workflows

Explore other categories

πŸ“¬

Get Started with Agentic Working

Subscribe to receive updates from AgenticWorking.io

πŸ“– Free eBook Guide πŸ“¦ 7 Ready-to-use Scripts πŸ”” Weekly Tips

No spam, unsubscribe anytime. Join 1,000+ subscribers.