LogLens
A streaming log-file analyzer for Python. Point it at a log file (plain or .gz) and get level breakdowns, top errors/warnings, minute/hour/day timelines, source stats, statistical anomaly detection, and a Rich terminal report either as a library or from the command line.
Status: early / incomplete. This README only documents the parts that are actually implemented today. See What's not finished yet.
Install
Not yet published to PyPI. Install locally from the project directory:
pip install -e .
(or pip install . for a normal, non-editable install)
Command line
loglens app.log # one-page summary
loglens app.log --full # full report: timeline, sources, samples...
loglens app.log --timeline # timeline-only view
loglens app.log --level ERROR --level CRITICAL
loglens app.log --pattern "database" # only lines matching a regex
loglens app.log --from 2026-08-22 --to "2026-08-22 12:00:00"
loglens app.log --json out.json # also dump the full result as JSON
loglens app.log --no-anomalies # skip anomaly detection
loglens app.log --no-progress # disable the progress bar
Run loglens --help for the full list of options.
Library
from loglens import LogAnalyzer, AnomalyDetector, ReportGenerator
result = LogAnalyzer().analyze("app.log")
result.anomalies = [a.to_dict() for a in AnomalyDetector().detect(result)]
ReportGenerator().print_summary(result) # or print_full_report(result)
print(result.error_rate) # % of parsed lines that were ERROR/CRITICAL
print(result.summary_stats) # compact dict of the headline numbers
result.to_dict() # full, JSON-serializable result
Supported log formats are auto-detected line by line: ISO-8601 / Python logging-style application logs, Apache combined log format, Nginx error logs, and syslog. You can also pass a custom compiled regex with level, time and message named groups to LogParser(custom_pattern=...) for anything else.
Logging helper
from loglens import get_logger
log = get_logger("etl")
log.info("starting run")
Attaches a console handler plus a rotating, gzip-compressing file handler
(./logs/<name>.log) - see loglens.constants.config for the defaults.
What's implemented
loglens.parser-LogParser,LogEntry,LogLevel: streaming, multi-format parsingloglens.analyzer-LogAnalyzer,AnalysisResult: aggregation & statsloglens.anomalies-AnomalyDetector,Anomaly: z-score spikes, IQR outliers, silence gaps, error burstsloglens.reports-ReportGenerator: Rich terminal reportsloglens.logger/loglens.rotation- configurable logging with compressed rotationloglens.exceptions-ApplicationExceptionloglens.cli- theloglenscommand above
What's not finished yet
These modules exist as placeholders in the source tree but have no implementation, and are not exposed from import loglens:
loglens.exporters- JSON/CSV/HTML export helpers (useresult.to_dict()+json.dumpfor now, orloglens --json)loglens.frames- pandas bridgeloglens.decorators- instrumentation decorators for data-science code
License
Apache-2.0 - see LICENSE.
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 peeklog-0.1.0.tar.gz.
File metadata
- Download URL: peeklog-0.1.0.tar.gz
- Upload date:
- Size: 32.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a40dad4e1dfab1e0b4aa132d779b62e64842add12434b17959d46eba37cdcbb
|
|
| MD5 |
ee671821f9e8a2604a778cf45891ba71
|
|
| BLAKE2b-256 |
8f03982e2c06ff2c65344091e1b9edda39458ec3be443ee88a5a971e4b5121f4
|
File details
Details for the file peeklog-0.1.0-py3-none-any.whl.
File metadata
- Download URL: peeklog-0.1.0-py3-none-any.whl
- Upload date:
- Size: 37.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.10.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ef6129419790915bc76317989b9debb92aa46f7478e38b8d8c0bbb3bf1d8649
|
|
| MD5 |
dd0ddb9702039680553f0402229395b4
|
|
| BLAKE2b-256 |
b793febec12893a48a5e6cc02b0a679c210a30ee6c860bdeb97f71fe9b05cc13
|