Skip to content

Rushabh5000/log-tail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

log-tail

Zero dependencies Node License: MIT Platform

Cross-platform tail -f replacement with regex filtering, JSON log parsing, level-based colorization, and multi-file watching. Zero dependencies.

Windows has no tail -f. PowerShell's Get-Content -Wait is clunky and doesn't filter. log-tail runs anywhere Node.js does.


Install

npm install -g log-tail

Or without installing:

npx log-tail server.log

Usage

log-tail server.log                        # tail -f equivalent
log-tail app.log error.log                 # Multiple files, labeled output
log-tail server.log --grep "ERROR|WARN"    # Filter lines
log-tail access.log --highlight "404"      # Highlight matches in red
log-tail app.json --json                   # Pretty-print JSON log lines
log-tail server.log -n 100 --no-follow     # Like `tail -100`, no follow
log-tail server.log --exclude "/health"    # Skip noisy lines

Auto-Colorization

Lines containing standard log levels are colored automatically:

Pattern Color
ERROR, FATAL, CRITICAL red
WARN, WARNING yellow
INFO, NOTICE cyan
DEBUG, TRACE dim

HTTP status codes (4xx, 5xx, etc.) are also highlighted.

Disable with --no-color.


JSON Log Mode

Given lines like:

{"level":"error","msg":"DB query timed out","timestamp":"2024-08-01T12:00:00Z","duration_ms":4012}

Run log-tail app.log --json:

2024-08-01T12:00:00Z ERROR DB query timed out  duration_ms=4012

Recognized fields:

  • Message: message, msg, text
  • Level: level, severity, lvl
  • Timestamp: timestamp, time, ts

All other fields are shown as key=value extras.


Multi-File

When watching multiple files, each line is labeled with the filename in its own color:

server.log │ GET /api/users 200 12ms
worker.log │ Processing job #12345
server.log │ POST /api/login 401 4ms

Options

Flag Default Description
-n, --lines <N> 10 Show last N lines before following
--follow / --no-follow follow Keep watching for new lines
--grep <pattern> Only show lines matching regex
--exclude <pattern> Skip lines matching regex
--highlight <pattern> Highlight matches in bold red
--interval <ms> 250 Poll interval
--json off Pretty-print JSON log lines
--no-color off Disable colorization

License

MIT


Keywords

tail -f windows · tail follow · log viewer · follow logs · tail logs · log tail · live logs · json logs · cross-platform · zero dependencies


Built to solve, shared to help — Rushabh Shah 🛠️✨

One of 40+ zero-dependency developer CLI tools — no node_modules, ever.

About

Cross-platform tail -f with regex filtering, multi-file, JSON pretty-print, and color — zero dependencies

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors