Tail your logs. Catch anomalies. Skip the 2am grep.
logometer watches a log file (or stdin), buckets lines into time windows, and flags windows that look statistically off — an error spike, or an error type that's never shown up before. It's silent when things are fine. No AI required for the core detection; point it at an LLM with --explain if you want a plain-English guess at why a window looks weird.
Zero dependencies for the core tool — just Python 3.10+.
pipx install git+https://github.com/AmanSg098/logometer.git Or from a clone, for development:
git clone https://github.com/AmanSg098/logometer.git cd logometer pip install -e . # core tool, no dependencies pip install -e ".[pretty]" # optional: styled output via rich Quick start Try it on the included sample log (has a normal-traffic baseline plus an injected error burst):
python3 -m logometer.cli tail examples/sample.log --replay or, once installed:
logometer tail examples/sample.log --replay Usage # Tail a live log file (like tail -f, but with anomaly detection) logometer tail /var/log/app.log # Pipe from stdin tail -f app.log | logometer tail - # Replay a static file from start to finish, then exit logometer tail app.log --replay # Only show anomalous windows, hide the "ok" noise logometer tail app.log --replay --quiet # Adjust window size (seconds) and how aggressively to flag deviations logometer tail app.log --window 30 --sensitivity high # Mute known-noisy lines so they never reach the baseline (repeatable regex) logometer tail app.log --ignore 'healthcheck' --ignore 'DeprecationWarning' # Ask an LLM for a one-sentence explanation of each anomaly export ANTHROPIC_API_KEY=your-key-here logometer tail app.log --explain # JSON output, one object per line — good for piping into other tools logometer tail app.log --format json Stop a live tail with Ctrl-C (or SIGTERM from a process manager); the window in progress is reported before exiting.
Timestamps are read from each line to decide which window it belongs to. Two formats are recognised:
Requires an API key for one of three providers, set in your environment:
OpenRouter gives one key access to models from many vendors; its model ids are prefixed with the vendor (openai/gpt-4o-mini, google/gemini-2.5-flash, …). No SDK install needed — it's a plain HTTPS call. If the key is missing or the request fails, logometer prints a one-line warning to stderr and keeps tailing normally; it never crashes because --explain had a bad day.
Only the anomalous window's ERROR and WARN lines are sent (capped at 30 lines). Pick a different model with --explain-model:
export OPENAI_API_KEY=your-key-here logometer tail app.log --explain --explain-provider openai --explain-model gpt-4o export OPENROUTER_API_KEY=your-key-here logometer tail app.log --explain --explain-provider openrouter --explain-model google/gemini-2.5-flash --ignore Real logs usually have one or two messages that fire constantly and mean nothing. Left alone they dominate the error count, so the rolling baseline learns them as "normal" and a genuine problem has to shout louder to get noticed. --ignore drops matching lines before any analysis:
# on a real macOS install log, one benign repeating message accounted for # 97% of all "errors" — muting it cut the noise dramatically logometer tail /var/log/install.log --replay --window 60 --quiet \ --ignore 'installation-check' # 27 anomalies -> 5, all genuine Each --ignore takes a regular expression and can be repeated. An invalid pattern is reported as a normal CLI error rather than a crash.
logometer tail app.log (without --replay) follows the file the way tail -f does, with two things a naive tail loop gets wrong:
Output is flushed as each window is reported, so piping or redirecting works in real time:
logometer tail app.log --quiet --format json >> alerts.jsonl tail -f app.log | logometer tail - Pretty output If you pip install rich (or pip install -e ".[pretty]"), terminal output automatically upgrades to styled panels. Not required — plain ANSI output works everywhere. When output is piped or redirected to a file it stays plain text either way; pass --no-pretty to get plain output in the terminal too.
With --explain, each anomaly gets one more line:
[12:01:30 – 12:01:40] ! ANOMALY errors: 10 warns: 1 baseline: ~0.1 score: 9.9x New error signature detected: ' ERROR ConnectionResetError: [Errno ] Connection reset by peer id= ' Explanation: Database or downstream service became unresponsive, causing clients to forcibly close connections due to timeouts or hangs. With --format json, each window is one line with these fields:
{"window_index": 9, "start": "12:01:30", "end": "12:01:40", "error_count": 10, "warn_count": 1, "baseline_mean": 0.111, "error_score": 9.889, "is_anomaly": true, "new_shapes": [" ERROR ConnectionResetError: [Errno ] Connection reset by peer id= "], "explanation": null} The end-of-run summary line is omitted in JSON mode, so every line of output is valid JSON.
No ML model, no training step — deliberately simple and explainable.
Worth knowing before you point this at something you care about. These are real, tested behaviours, not hypotheticals:
python3 -m unittest discover -s tests -v No network or API key is needed — the --explain tests mock the HTTP call.
logometer/ cli.py command-line entry point, file/stdin reading, output formatting classifier.py severity tagging and error-shape fingerprinting timeparse.py timestamp extraction (ISO 8601, syslog) windower.py groups lines into time- or count-based windows baseline.py rolling mean / standard deviation of errors per window detector.py decides whether a window is anomalous explain.py optional LLM explanations (Anthropic / OpenAI / OpenRouter over plain HTTPS) pretty.py optional rich-styled output tests/ unit and end-to-end tests examples/ sample log with an injected error burst docs/ flow diagram (Mermaid source + rendered PNG) Roadmap Config file for custom log-format parsing Multiple file / glob support Slack/Discord webhook alerts Persistent anomaly history (SQLite) Contributing Issues and PRs welcome — especially around log-format parsing (every stack logs differently) and reducing false positives.
logs logging anomaly-detection monitoring cli tail
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.




