API Log Viewer: A Powerful Terminal-Based Log Analysis Tool


{getToc} $title={Table of Contents} $count={true}

🚀 API Log Viewer

A Professional Terminal-Based Log Analysis Tool for Developers

📝 Introduction

As developers, we spend countless hours analyzing logs to debug issues, monitor application performance, and understand user behavior. Traditional log analysis tools can be cumbersome, requiring heavy installations or expensive licenses. That's why I created API Log Viewer – a lightweight, powerful, and beautiful terminal-based log analysis tool that makes log viewing a breeze.

🎯 What is API Log Viewer?

API Log Viewer is a sophisticated Python-based terminal application designed to parse, analyze, and visualize API logs with ease. Whether you're working with JSON logs, plain text logs, or Java/Spring application logs, this tool intelligently handles them all with beautiful formatting and powerful filtering capabilities.

✨ Key Features

  • Multi-Format Support: JSON, plain text, Apache/Nginx, and custom formats
  • Smart Parsing: Automatically detects and parses log formats
  • Beautiful UI: Rich terminal interface with color-coded output
  • Powerful Filtering: Filter by level, status, service, thread, or custom search
  • Unicode Support: Full support for international characters (Khmer, Chinese, etc.)
  • Export Functionality: Save filtered results for further analysis
  • Standalone Executable: Build once, run anywhere – no Python required
  • Lightning Fast: Handles large log files with ease

💡 Why You Need This Tool

🔍 Quick Error Detection

Filter and export all errors in seconds, saving hours of manual searching through massive log files.

📊 Instant Statistics

Get comprehensive log summaries with status code distributions, top services, and thread analysis.

🎨 Beautiful Presentation

Color-coded log levels, formatted tables, and syntax highlighting make logs easy to read and understand.

🚀 Quick Start Guide

Method 1: Run with Python

# Clone the repository
git clone https://github.com/setyuth/api-log-viewer.git
cd api-log-viewer

# Install dependencies
pip install -r requirements.txt

# Run the application
python main.py examples/sample_json.log

Method 2: Build Standalone Executable

# Install PyInstaller
pip install pyinstaller

# Build executable (Windows)
pyinstaller --onefile --console --name="LogViewer" logviewer_standalone.py

# Run the executable
dist\LogViewer.exe your_log_file.log

💡 Pro Tip: The standalone executable works on any machine without Python installed – perfect for sharing with your team!

📋 Supported Log Formats

1️⃣ JSON Logs

{"timestamp": "2024-01-20T10:30:45Z", "level": "INFO", "method": "GET", "path": "/api/users", "status": 200}

2️⃣ Plain Text Logs

2024-01-20 10:30:45 INFO GET /api/users 200 45ms

3️⃣ Java/Spring Logs

08:27:33.453 [http-nio-28080-exec-10] INFO k.g.t.g.c.BackendInvoiceCntr :: /CINV00101L005 START

⚡ Powerful Features in Action

🔍 Smart Filtering

# Filter by log levelfilter level ERROR

# Filter by status code
› filter status 404

# Filter by service/controller
› filter service BackendInvoiceCntr

# Search for specific text (supports Unicode!)
› filter search timeout
› filter search ជំរាបសួរ

📊 Comprehensive Statistics

# View detailed summary
› summary

Output:
- Total Entries: 1,250
- Log Levels: ERROR: 45, INFO: 1,205
- Status Codes: 200: 1,100, 404: 30, 500: 15
- Top Services: BackendInvoiceCntr, InvoiceDataEntryCntr
- Top Threads: http-nio-28080, SimpleAsyncTaskExecutor

💾 Export Filtered Results

# Export all errors to a file
› filter level ERROR
› export production_errors_2024.log

# Export specific service logs
› filter service PaymentController
› export payment_logs.log

🎯 Real-World Use Cases

1. Debugging Production Issues

Quickly filter error logs, identify patterns, and export relevant entries for your team to investigate. The thread tracking feature helps you follow a single request through the entire application flow.

2. Performance Monitoring

Track specific endpoints, analyze response times, and identify bottlenecks. Filter by service to see which components are causing the most errors or slowdowns.

3. Security Auditing

Filter failed authentication attempts (401/403 status codes), track suspicious activity patterns, and export security-related logs for compliance reporting.

4. API Analytics

Analyze API usage patterns, identify most-called endpoints, and understand user behavior through comprehensive log statistics and filtering.

🔧 Advanced Features

🌍 Unicode Support

Full support for international characters including Khmer, Chinese, Japanese, Arabic, and more. Perfect for multinational applications.

› filter search ជំរាបសួរ ពិភពលោក ✓

🧵 Thread Tracking

Follow a single request through multiple log entries by filtering on thread names. Essential for debugging complex request flows.

› filter thread http-nio-28080-exec-10

📝 Log Editing

Edit individual log entries and save changes back to the file. Useful for data sanitization or testing.

› view 25
› edit 25
› save

📦 Build Standalone Executable

One of the most powerful features is the ability to create a standalone executable that runs on any machine without Python installed.

Windows Build

build_windows.bat

Linux/macOS Build

./build_unix.sh

The resulting executable is typically 15-20MB and includes everything needed to run the application!

💻 System Requirements

For Running from Source:

  • Python 3.7 or higher
  • pip package manager
  • UTF-8 capable terminal (recommended)

For Standalone Executable:

  • Windows 7/10/11, Linux, or macOS 10.12+
  • No Python installation required
  • 50MB RAM minimum
  • Any modern terminal emulator

🎓 Getting Started

  1. Clone the repository: git clone https://github.com/setyuth/api-log-viewer.git
  2. Install dependencies: pip install -r requirements.txt
  3. Run with example: python main.py examples/sample_json.log
  4. Try filtering: Type filter level ERROR and press Enter
  5. View help: Type help to see all available commands

🤝 Contributing

This is an open-source project and contributions are welcome! Whether you want to report bugs, suggest features, or submit pull requests, your input is valuable.

Ways to Contribute:

  • 🐛 Report bugs and issues
  • 💡 Suggest new features
  • 📝 Improve documentation
  • 🔧 Submit pull requests
  • ⭐ Star the repository on GitHub
  • 📢 Share with your team

🗺️ Roadmap

Exciting features planned for future releases:

  • 📈 Real-time log monitoring with live updates
  • 📊 Data visualization with charts and graphs
  • 🔔 Alert system for critical errors
  • 💾 Database integration for log storage
  • 🌐 Web interface option
  • 🤖 AI-powered anomaly detection
  • 📱 Mobile companion app

🎉 Conclusion

API Log Viewer transforms the tedious task of log analysis into a pleasant and efficient experience. Whether you're debugging production issues, monitoring performance, or conducting security audits, this tool has you covered.

Try it today and see how much time you can save! The tool is completely free and open-source, ready to become an essential part of your development toolkit.

🚀 Get Started Now!

Star ⭐ the repository if you find it useful!

Previous Post Next Post