Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

log-sieve

A fast CLI tool for filtering, analyzing, and summarizing log files. Supports multiple log formats, pattern detection, severity filtering, and provides statistical summaries — all from the command line.

Features

  • Multi-format parsing: Auto-detects syslog, Apache/nginx, JSON, and plain text logs
  • Severity filtering: Filter by log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
  • Pattern detection: Find repeated patterns and error clusters
  • Time range filtering: Narrow results to specific time windows
  • Summary statistics: Get frequency counts, top errors, and timeline breakdowns
  • Color-coded output: Easy visual scanning of severity levels
  • Streaming mode: Process logs line-by-line for memory efficiency

Installation

git clone https://github.com/technicalanalysis00005-cell/log-sieve.git
cd log-sieve
pip install -r requirements.txt

Usage

# Filter errors and above from a log file
python log_sieve.py /var/log/syslog --level ERROR

# Get summary statistics
python log_sieve.py app.log --summary

# Filter by time range
python log_sieve.py app.log --from "2025-01-01 08:00" --to "2025-01-01 12:00"

# Search for a specific pattern
python log_sieve.py app.log --grep "timeout|connection refused"

# Detect error clusters (repeated patterns)
python log_sieve.py app.log --clusters

# Pipe from stdin
cat /var/log/syslog | python log_sieve.py - --level WARNING

# Read last N lines
python log_sieve.py app.log --tail 100 --level ERROR

# Output as JSON
python log_sieve.py app.log --summary --json

Supported Log Formats

Format Example
Syslog Jan 1 12:00:00 host program[1234]: message
Apache/Nginx 127.0.0.1 - - [01/Jan/2025:12:00:00 +0000] "GET / HTTP/1.1" 200
JSON {"timestamp": "...", "level": "ERROR", "message": "..."}
Plain text Any line with recognized level keywords

How It Works

log-sieve reads log files line-by-line, attempts to parse each line using a chain of format parsers, extracts timestamp + severity + message, then applies filters before outputting results. The --summary mode aggregates statistics without printing individual lines.

License

MIT

About

CLI log file filter, analyzer and summarizer - supports syslog, Apache, JSON, plain text

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages