Skip to content

nord342/logwise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logwise

A fast CLI tool to analyze, search, and summarize large text files and logs.

Find errors, extract timelines, count word frequencies, search with regex, and optionally get AI-powered summaries — all from your terminal.

Install

pip install git+https://github.com/nord342/logwise.git

With AI summarization support (uses Claude):

pip install "logwise[ai] @ git+https://github.com/nord342/logwise.git"

Quick Start

# Full analysis of a log file
logwise analyze server.log

# Find all errors and issues
logwise errors production.log --context 3

# Search with regex
logwise search app.log 'timeout|refused' --context 2

# Extract timeline
logwise timeline server.log

# AI-powered summary (requires ANTHROPIC_API_KEY)
logwise summarize server.log

Commands

logwise analyze

Full analysis: overview stats, log level counts, error detection, word frequency, timeline, and regex matches.

logwise analyze server.log
logwise analyze app.log --top-words 30
logwise analyze app.log --regex 'status=5\d{2}'
logwise analyze server.log --export report.md

Flags:

Flag Description
--top-words N Number of top words to display (default: 20)
--regex PATTERN Highlight lines matching a regex pattern
--export FILE Export full report to Markdown
--encoding ENC File encoding (default: utf-8)

logwise errors

Find and display all errors, exceptions, failures, and other issues.

logwise errors production.log
logwise errors app.log --context 5
logwise errors server.log --export errors.md

Flags:

Flag Description
--context N Lines of context around each error
--export FILE Export errors to Markdown

logwise search

Search files with regex patterns. Supports context lines and case sensitivity.

logwise search app.log 'connection (refused|timeout)'
logwise search data.txt 'ERROR' --case-sensitive
logwise search server.log 'user_id=\d+' --context 2 --export matches.md

Flags:

Flag Description
--context N Lines of context around matches
--case-sensitive Case-sensitive search (default: case-insensitive)
--export FILE Export results to Markdown

logwise timeline

Extract and display all timestamped entries. Supports ISO 8601, syslog, Apache/Nginx, and common log formats.

logwise timeline server.log
logwise timeline app.log --limit 100

Flags:

Flag Description
--limit N Max entries to display (default: 50)

logwise summarize

AI-powered summary using Claude. Requires the anthropic package and ANTHROPIC_API_KEY environment variable.

logwise summarize server.log
logwise summarize crash.log --prompt "Focus on the root cause of failures"
logwise summarize app.log --export summary.md

Flags:

Flag Description
--prompt TEXT Custom prompt for the AI
--max-lines N Max lines to send to AI (default: 5000)
--model MODEL Claude model to use
--export FILE Export summary to Markdown

What It Detects

Log levels: DEBUG, INFO, NOTICE, WARN/WARNING, ERROR, CRITICAL, FATAL, SEVERE, ALERT, EMERGENCY, TRACE

Error indicators: error, exception, traceback, failed, failure, crash, panic, abort, segfault, out of memory, killed, timeout, refused, denied, unauthorized, cannot, could not, unable to, not found, missing, broken, corrupt

Timestamp formats:

  • ISO 8601: 2024-01-15T10:30:45Z
  • Common: 2024-01-15 10:30:45
  • Syslog: Jan 15 10:30:45
  • Apache/Nginx: 15/Jan/2024:10:30:45 +0000
  • Bracketed: [2024-01-15 10:30:45]

Export

Any command with --export flag generates a clean Markdown report:

logwise analyze server.log --export report.md
logwise errors app.log --export errors.md
logwise search data.txt 'pattern' --export matches.md
logwise summarize crash.log --export summary.md

Use Cases

  • Debugging — quickly find errors and trace timelines in application logs
  • Incident response — scan production logs for failures and anomalies
  • Log review — get summaries of large log files without reading every line
  • Journal/notes — search and summarize long text documents
  • Data exploration — find patterns in CSV, TSV, or other text data

Development

git clone https://github.com/nord342/logwise.git
cd logwise
pip install -e ".[all]"
pytest

License

MIT

About

CLI tool to analyze, search, and summarize large text files and logs — word frequency, error counting, timeline extraction, regex search, and AI-powered summaries. Export excerpts to Markdown

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages