Skip to main content

Lightweight CLI for analyzing server log files

Project description

The Awesome Log lens Logo goes here

Log Lens ๐Ÿ”

**Under development and refactoring might have some hiccups along the way, so it may not work perfectly every time. Thanks for understanding! **

PyPI version Tests Code style: black

Lightweight CLI for analyzing Apache/Nginx server logs. Auto-detects format, extracts status codes, top IPs/paths, HTTP methods, and exports JSON.

๐Ÿš€ Features

  • Auto log format detection (Apache, generic logs)
  • Status codes (200, 404, 500 analysis)
  • Top IPs, paths, & methods with beautiful tables
  • Rich CLI with colors & professional formatting
  • JSON export for dashboards/tools
  • Production ready (tests, linting, CI)

๐Ÿ›  Quick Install

pip install log-lens

Or from source:

git clone https://github.com/KnowOneActual/log-lens.git
cd log-lens
pip install -e .

๐Ÿ“– Usage Examples

Basic analysis:

log-lens access.log

Apache access logs:

log-lens /var/log/apache2/access.log

Export JSON + limit IPs:

log-lens access.log --top-ips 5 -e report.json

๐ŸŽจ Sample Output

โœ… Analyzed access.log: 1,234 lines
๐Ÿ“Š Found 1,234 entries
๐Ÿ“‹ Format: APACHE

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Status Codes โ”‚     โ”‚   Top IPs    โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚     200      โ”‚ 892 โ”‚  192.1.2.3  โ”‚ 156
โ”‚     404      โ”‚  45 โ”‚  10.0.0.15  โ”‚  89
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿงช Development

# Install dev tools
pip install -e .[dev]

# Run tests
pytest tests/

# Format code
pre-commit run --all-files

๐Ÿ“„ JSON Schema

{
  "format": "apache",
  "ips": {"192.168.1.1": 42},
  "status_codes": {"200": 892, "404": 45},
  "top_paths": {"/": 156, "/api/login": 23}
}

๐Ÿค Contributing

  1. Fork & clone
  2. pip install -e .[dev]
  3. pre-commit install
  4. Add tests in tests/
  5. Submit PR!

๐Ÿ“ˆ Roadmap

See ROADMAP.md


Made with โค๏ธ using Rich, Black, pre-commit

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

log_lens-0.4.0.tar.gz (54.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

log_lens-0.4.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file log_lens-0.4.0.tar.gz.

File metadata

  • Download URL: log_lens-0.4.0.tar.gz
  • Upload date:
  • Size: 54.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for log_lens-0.4.0.tar.gz
Algorithm Hash digest
SHA256 f0c32950bf68f88883e6e9f0f0562418f48db49e67d2af789c72e3ab54c176dd
MD5 77e06abe6a7ee651aa0851d2e6228321
BLAKE2b-256 9cd1ddbf299cdf1c0199274006e345ec6ae563721a64f680ada1ab2ba2f1219a

See more details on using hashes here.

File details

Details for the file log_lens-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: log_lens-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for log_lens-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 73baf96c9ea660b5455bcc954e7ba2bc3800a63bf1a32d92d09d85b0959e53e9
MD5 f1df66f3547512808279a22b2e2b8d2a
BLAKE2b-256 6d464a5e6fdf2539891bd661bf33ecb6c2623dc2696bb397f9df742ea15ebb0c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page