LogLense is a small, fast command-line utility for parsing, filtering, and watching log files with structured, colorized output and minimal configuration.
Key goals:
- Fast, zero-configuration parsing of common log formats
- Human-friendly terminal output with level coloring and compact columns
- Composable commands for searching, tailing, and exporting
- 🔎 Level filtering (DEBUG, INFO, WARN, ERROR, FATAL)
- 🔁 Live tail/watch mode with history buffer
- 🧭 Regex or keyword search with inline highlights
- ⏱ Time-range slicing with
--since/--until - 📂 Aggregate multiple files with automatic
Filecolumn - 📤 Export to CSV, JSON, or plain text
- ⚙️ Auto-detection for Python logging, Nginx, Apache CLF, and generic formats
pip install loglensgit clone https://github.com/your-username/LogLense.git
cd LogLense
pip install -e .- Parse one or more files:
# show parsed entries
loglens parse sample_logs/app.log- Watch a file live (shows history then streams new lines):
loglens watch sample_logs/app.log --level ERROR- Aggregate and export errors to JSON:
loglens parse app.log worker.log --level ERROR --export errors.jsonparse— filter and render log entrieswatch— live tail a filestats— show aggregate metrics
Use --help on any subcommand for full options, e.g. loglens parse --help.
LogLense/
├── loglens/ # Python package
│ ├── __init__.py
│ ├── main.py # CLI entrypoints
│ ├── parser.py # Parsing & detection logic
│ ├── filters.py # Filter helpers
│ ├── exporter.py # Export to CSV/JSON
│ └── watcher.py # Tail/watch implementation
├── sample_logs/ # Example log files used in tests/docs
├── tests/ # Unit tests
├── pyproject.toml # Project metadata & dependencies
├── README.md
└── LICENSE
| Component | Technology |
|---|---|
| Language | Python 3.8+ |
| CLI framework | Click / argparse |
| Output/style | rich (color + tables) |
| Testing | pytest |
| Packaging | pyproject.toml / pip |
- Hidden or system files (e.g.
.DS_Store,desktop.ini) are skipped by default. - The tool never mutates source files;
parse/watchare read-only. - Actions that could delete or overwrite files require explicit user confirmation.
Install development dependencies and run tests:
pip install -e .[dev]
pytest -qRun the CLI locally:
python -m loglens parse sample_logs/app.logContributions are welcome. Please:
- Fork the repo
- Create a feature branch
- Add tests for new behavior
- Open a pull request
See CONTRIBUTING.md if present for coding guidelines.
Apache 2.0 — see LICENSE for details.
Designed for fast, human-friendly log exploration.