Lightweight CLI for analyzing server log files
Project description
Log Lens ๐
**Under development and refactoring might have some hiccups along the way, so it may not work perfectly every time. Thanks for understanding! **
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
- Fork & clone
pip install -e .[dev]pre-commit install- Add tests in
tests/ - Submit PR!
๐ Roadmap
See ROADMAP.md
Made with โค๏ธ using Rich, Black, pre-commit
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0c32950bf68f88883e6e9f0f0562418f48db49e67d2af789c72e3ab54c176dd
|
|
| MD5 |
77e06abe6a7ee651aa0851d2e6228321
|
|
| BLAKE2b-256 |
9cd1ddbf299cdf1c0199274006e345ec6ae563721a64f680ada1ab2ba2f1219a
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73baf96c9ea660b5455bcc954e7ba2bc3800a63bf1a32d92d09d85b0959e53e9
|
|
| MD5 |
f1df66f3547512808279a22b2e2b8d2a
|
|
| BLAKE2b-256 |
6d464a5e6fdf2539891bd661bf33ecb6c2623dc2696bb397f9df742ea15ebb0c
|