Skip to content

Interactive desktop tool for analyzing, filtering, and visualizing large log files. Built with Python and PyQt5.

License

Notifications You must be signed in to change notification settings

BaseMax/qt-log-analyzer

Repository files navigation

Qt Log Analyzer

Interactive desktop tool for analyzing, filtering, and visualizing large log files. Built with Python and PyQt5.

Screenshots

Main Interface with Loaded Logs

Log Entries View

Filtered Error Logs with Anomaly Highlighting

Filtered View

Timeline Visualization

Timeline Chart

Statistics Dashboard

Statistics Dashboard

Features

  • Fast Loading: Background processing for large log files without freezing the UI
  • Multiple Formats: Support for both text and JSON log files
  • Advanced Filtering: Filter logs by:
    • Log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
    • Time range
    • Source/Logger
    • Regex pattern matching
    • Anomaly detection
  • Timeline Visualization: Interactive timeline chart showing log activity over time
  • Statistics Dashboard: Comprehensive statistics with charts:
    • Log level distribution (pie chart)
    • Top log sources (bar chart)
    • Error distribution
    • Summary metrics
  • Anomaly Highlighting: Automatic detection and highlighting of errors and anomalies
  • Export Functionality: Export filtered results to CSV, JSON, or text formats
  • Modern UI: Clean, responsive interface with color-coded log levels

Installation

  1. Clone the repository:
git clone https://github.com/BaseMax/qt-log-analyzer.git
cd qt-log-analyzer
  1. Install dependencies:
pip install -r requirements.txt

Usage

Run the application:

python main.py

Basic Workflow

  1. Open Log File: Click "📁 Open Log File" button and select a log file (.log, .txt, or .json)
  2. View Logs: Browse logs in the table view with color-coded levels
  3. Apply Filters: Use the filter panel to narrow down logs:
    • Select specific log level
    • Choose source/logger
    • Set time range
    • Enter regex pattern for message search
    • Enable "Anomalies Only" to see detected issues
  4. View Timeline: Switch to "Timeline" tab to see log activity over time
  5. View Statistics: Switch to "Statistics" tab for detailed analytics
  6. Export Results: Click "💾 Export Filtered" to save filtered logs

Sample Logs

Sample log files are provided in the sample_logs/ directory:

  • sample.log: Text format log file
  • sample.json: JSON format log file

Supported Log Formats

Text Logs

The analyzer supports multiple text log formats:

# Format 1: Timestamp - Level - Message
2024-01-15 10:23:45 - INFO - Application started

# Format 2: [Timestamp] Level: Message
[2024-01-15 10:23:45] INFO: Application started

# Format 3: Timestamp Source Level: Message
2024-01-15 10:23:45 app.main INFO: Application started

# Format 4: Level Timestamp [Source] Message
INFO 2024-01-15 10:23:45 [app.main] Application started

JSON Logs

JSON logs should have one JSON object per line:

{"timestamp": "2024-01-15T10:23:45", "level": "INFO", "source": "app.main", "message": "Application started"}

Supported fields:

  • timestamp or time: Timestamp string
  • level or severity: Log level
  • source or logger: Source/logger name
  • message or msg: Log message

Architecture

Components

  • log_parser.py: Parses text and JSON log files
  • log_filter.py: Filters log entries based on criteria
  • log_statistics.py: Calculates statistics and metrics
  • timeline_widget.py: Timeline visualization widget
  • statistics_widget.py: Statistics dashboard widget
  • main.py: Main application and GUI

Features

Background Processing

Large files are loaded in a background thread to prevent UI freezing. Progress is shown in a progress bar.

Anomaly Detection

Automatic detection of anomalies using heuristics:

  • All ERROR and CRITICAL level logs
  • Frequently occurring errors

Color Coding

Log levels are color-coded for easy identification:

  • DEBUG: Gray
  • INFO: Green
  • WARNING: Orange
  • ERROR: Red
  • CRITICAL: Dark Red

Requirements

  • Python 3.7+
  • PyQt5 5.15.0+
  • matplotlib 3.5.0+
  • pandas 1.3.0+
  • python-dateutil 2.8.0+

License

MIT License - see LICENSE file for details

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Author

BaseMax

About

Interactive desktop tool for analyzing, filtering, and visualizing large log files. Built with Python and PyQt5.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages