Skip to content

Repository files navigation

🔍 Log File Analyzer

A Python-based tool to parse, analyze, and visualize Apache/Nginx server access logs -
available as both a CLI tool and a GUI dashboard.

Python CustomTkinter


✨ Features

  • Parse raw Apache/Nginx access logs using Regex
  • Analyze top IPs, URLs, and HTTP status codes
  • Beautiful dashboard UI built with CustomTkinter
  • Full CLI support with argparse
  • Auto-saves reports to reports/ folder with timestamp
  • Filter logs by IP address or status code
  • Clean modular architecture - one file, one job

📁 Project Structure

log_analyzer/
│
├── main.py          → CLI entry point (argparse)
├── ui.py            → GUI dashboard (CustomTkinter)
├── core.py          → Bridge between logic and UI
├── log_parser.py    → File reading & regex parsing
├── analyzer.py      → Counter-based analysis
├── report.py        → Report generation
│
├── log_files/       → Sample log files
├── reports/         → Generated reports
│
├── HOW_TO_RUN.md    → Setup and usage guide
└── README.md

🚀 Quick Start

# 1. Clone the repo
git clone https://github.com/anjanakri/log-analyzer.git
cd log-analyzer

# 2. Create and activate virtual environment
python -m venv .venv
.venv\Scripts\activate        # Windows
source .venv/bin/activate     # Mac/Linux

# 3. Install dependencies
pip install customtkinter

# 4. Run CLI
python main.py --file log_files/sample.log

# 5. OR run GUI
python ui.py

🖥️ CLI Usage

# Analyze a log file
python main.py --file log_files/sample.log

# Get help
python main.py --help

🎨 GUI Dashboard

Run python ui.py to launch the dashboard:

Section What it shows
Stat Cards Total requests, 200 OK, 404, 500 counts
Log Table Every log entry with color coded status
Stats Tab Top IPs, URLs, status breakdown
Filter Tab Filter by IP address or status code

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages