{"id":51008388,"url":"https://github.com/voidd0/logparse","last_synced_at":"2026-06-20T23:30:59.776Z","repository":{"id":353200390,"uuid":"1218373756","full_name":"voidd0/logparse","owner":"voidd0","description":"parse nginx/apache/syslog into structured records. pipe-friendly.","archived":false,"fork":false,"pushed_at":"2026-04-29T06:14:43.000Z","size":21,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-15T20:46:19.974Z","etag":null,"topics":["apache-logs","cli","devtools","javascript","log-analysis","log-parser","nginx-logs","nodejs"],"latest_commit_sha":null,"homepage":"https://tools.voiddo.com/logparse/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/voidd0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-22T20:11:48.000Z","updated_at":"2026-04-29T22:55:26.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/voidd0/logparse","commit_stats":null,"previous_names":["voidd0/logparse"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/voidd0/logparse","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voidd0%2Flogparse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voidd0%2Flogparse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voidd0%2Flogparse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voidd0%2Flogparse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/voidd0","download_url":"https://codeload.github.com/voidd0/logparse/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voidd0%2Flogparse/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34589204,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-20T02:00:06.407Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apache-logs","cli","devtools","javascript","log-analysis","log-parser","nginx-logs","nodejs"],"created_at":"2026-06-20T23:30:59.398Z","updated_at":"2026-06-20T23:30:59.764Z","avatar_url":"https://github.com/voidd0.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# logparse\n\n[![npm version](https://img.shields.io/npm/v/@v0idd0/logparse.svg?color=A0573A)](https://www.npmjs.com/package/@v0idd0/logparse)\n[![npm downloads](https://img.shields.io/npm/dw/@v0idd0/logparse.svg?color=1F1A14)](https://www.npmjs.com/package/@v0idd0/logparse)\n[![License: MIT](https://img.shields.io/badge/license-MIT-A0573A.svg)](LICENSE)\n[![Node ≥14](https://img.shields.io/badge/node-%E2%89%A514-1F1A14)](package.json)\n\n**[Homepage](https://tools.voiddo.com/logparse/?ref=logparse-readme)** · **[GitHub](https://github.com/voidd0/logparse)** · **[npm](https://www.npmjs.com/package/@v0idd0/logparse)** · **[All tools](https://tools.voiddo.com/?ref=logparse-catalog-readme)** · **[Contact](mailto:support@voiddo.com)**\n\n---\n\n**Structured log parser / filter / aggregator.** Auto-detects JSON, plain-text, nginx, Apache, syslog, and Python-logging. Filter by level, grep, time range; aggregate into top templates and time buckets. Works on files or stdin.\n\nFree forever gift from [vøiddo](https://voiddo.com).\n\n```\n$ logparse app.log --top 5\n\n  TOP MESSAGE TEMPLATES\n  ─────────────────────\n     847  ██████████████████  [ERROR] Failed to connect to db id=\u003cnum\u003e\n     312  ██████░░░░░░░░░░░░  [WARN]  Slow query id=\u003cnum\u003e took \u003cdur\u003e\n      94  ██░░░░░░░░░░░░░░░░  [INFO]  User login email=\u003cemail\u003e\n      41  █░░░░░░░░░░░░░░░░░  [ERROR] Redis timeout after \u003cdur\u003e\n      12  ░░░░░░░░░░░░░░░░░░  [FATAL] Out of memory\n```\n\n## Why logparse\n\n`grep` doesn't know what a log \"entry\" is. `jq` only works on JSON. `lnav` is a full TUI you install for this one task. `awk` works but you're gonna write 3 lines every time.\n\nlogparse is one binary that:\n- **auto-detects** every log format in common use (JSON, text, nginx/apache combined, syslog RFC 3164, Python logging),\n- **filters** by level (`-l error,warn`), grep (`-g timeout`), time (`--last 1h`), severity threshold (`--min-level warn`),\n- **aggregates** into top-N message templates (normalized) or per-bucket counts,\n- **streams** with `tail -f` semantics or from stdin,\n- emits JSON / NDJSON / CSV envelopes for piping into `jq` or loading into a spreadsheet.\n\n## Install\n\n```bash\nnpm install -g @v0idd0/logparse\n```\n\nOr one-shot with `npx`:\n\n```bash\ntail -f app.log | npx -y @v0idd0/logparse --min-level error\n```\n\n## Quickstart\n\n```bash\n# Parse a mixed-format log, print colored\nlogparse app.log\n\n# Just errors + warnings\nlogparse app.log -l error,warn\n\n# Severity threshold (warn + error + fatal)\nlogparse app.log --min-level warn\n\n# Last hour, only entries matching \"timeout\"\nlogparse app.log --last 1h -g timeout\n\n# Top 10 noisiest templates (normalizes IDs/IPs/UUIDs)\nlogparse app.log --top 10\n\n# Events per hour\nlogparse app.log --bucket 1h\n\n# Dedupe consecutive repeats → \"heartbeat (×327)\"\nlogparse app.log --dedupe\n\n# Read from stdin\ntail -f app.log | logparse --min-level error\n\n# nginx access log → JSON\nlogparse access.log --format nginx --json\n\n# systemd journal → top 5 offenders\njournalctl -u myapp | logparse --format syslog --top 5\n\n# Live stream errors only\nlogparse -f app.log --min-level error\n```\n\n## Supported formats (auto-detected)\n\n| Format | Example |\n|--------|---------|\n| **JSON lines** | `{\"timestamp\":\"2026-04-22T12:00Z\",\"level\":\"error\",\"message\":\"boom\"}` |\n| **text** | `2026-04-22 12:00:00 ERROR something failed` |\n| **bracketed** | `[2026-04-22T12:00Z] [ERROR] something failed` |\n| **python-logging** | `2026-04-22 12:00:00,123 - myapp.views - ERROR - something broke` |\n| **nginx combined** | `1.2.3.4 - - [22/Apr/2026:12:00:00 +0000] \"GET / HTTP/1.1\" 200 532 \"-\" \"curl\"` |\n| **apache common** | Same as nginx but without referer/user-agent |\n| **syslog RFC 3164** | `Apr 22 12:00:00 host sshd[1234]: Accepted publickey for user` |\n\nFor HTTP access logs, status codes auto-map to levels: `5xx → error`, `4xx → warn`, `\u003c400 → info`.\n\nForce a specific parser with `--format text|json|nginx|apache|syslog`.\n\n## Options\n\n### Filters\n| Flag | Description |\n|------|-------------|\n| `-l, --level \u003clevels\u003e` | Keep these levels (comma-sep) |\n| `--min-level \u003clevel\u003e` | Keep entries at or above this severity |\n| `--after \u003cdate\u003e` | Entries after date |\n| `--before \u003cdate\u003e` | Entries before date |\n| `--last \u003coffset\u003e` | Last N time (`1h`, `30m`, `7d`, `500s`) |\n| `-g, --grep \u003cpattern\u003e` | Keep entries matching regex |\n| `-v, --invert \u003cpattern\u003e` | Drop entries matching regex |\n\n### Aggregation\n| Flag | Description |\n|------|-------------|\n| `-c, --count` | Table of counts by level |\n| `--top \u003cN\u003e` | Top N message templates (IDs/IPs/UUIDs normalized) |\n| `--dedupe` | Collapse consecutive repeats into `message (×N)` |\n| `--bucket \u003coffset\u003e` | Per-bucket counts (`1h`, `15m`, `1d`) |\n\n### Output\n| Flag | Description |\n|------|-------------|\n| `--json` | JSON array |\n| `--ndjson` | One JSON object per line |\n| `--csv` | CSV with `timestamp,level,message` |\n| `-f, --follow` | Stream new lines (tail -f semantics) |\n| `--format \u003cfmt\u003e` | Force-parse as `text`, `json`, `nginx`, `apache`, or `syslog` |\n| `-h, --help` | Show help |\n| `--version` | Show version |\n\n## Features worth calling out\n\n### Template extraction (`--top`)\nNormalizes IDs, IPs, UUIDs, durations, timestamps, and big numbers out of messages, then aggregates. Turns a 50,000-line log into a 10-line signal:\n\n```\n  847  ██████████████████  [ERROR] Failed to connect to db id=\u003cnum\u003e\n  312  ██████░░░░░░░░░░░░  [WARN]  Slow query id=\u003cnum\u003e took \u003cdur\u003e\n```\n\n### Time bucketing\n`--bucket 1h` groups events into hourly windows and prints level breakdowns as mini bars. Great for \"is the error rate climbing?\" without opening Grafana.\n\n### HTTP access log awareness\nnginx/apache lines auto-parse into structured records with `status`, `method`, `path`, `ip`, `userAgent`. The `--json` envelope carries them through as `extra` fields.\n\n### Stream from anything\n`tail -f /var/log/app.log | logparse --min-level error` is a poor man's alert pipeline. `journalctl -fu myapp | logparse --top 5` gives you a live-updating \"noisiest\" view.\n\n## Exit codes\n\n| Code | Meaning |\n|------|---------|\n| `0`  | Ran cleanly |\n| `1`  | File not found, input error, or unknown command |\n\n## Programmatic use\n\n```js\nconst {\n  parseLine, parseFile, parseString,\n  filterByLevel, filterAtLeast, filterByTime, filterByPattern, invertFilter,\n  countByLevel, topMessages, dedupe, bucketEvents, normalizeMessage,\n  formatOutput, parseTimeOffset,\n} = require('@v0idd0/logparse/src/parser');\n\nconst entries = parseFile('/var/log/app.log');\nconst errors  = filterAtLeast(entries, 'error');\nconst top     = topMessages(errors, 10);\n\n// Or parse a single line\nconst entry = parseLine('127.0.0.1 - - [22/Apr/2026:12:00:00 +0000] \"GET / HTTP/1.1\" 200 532 \"-\" \"curl\"');\n// =\u003e { format: 'nginx', level: 'info', extra: { status: 200, method: 'GET', path: '/' }, ... }\n```\n\n## From the same studio\n\nvøiddo builds sharp, free-forever CLIs for devs who are tired of paywalls:\n\n- [`@v0idd0/jsonyo`](https://tools.voiddo.com/jsonyo/?ref=logparse-related-jsonyo-readme) — JSON that yells at you\n- [`@v0idd0/tokcount`](https://tools.voiddo.com/tokcount/?ref=logparse-related-tokcount-readme) — token counter for 60+ LLMs\n- [`@v0idd0/ctxstuff`](https://tools.voiddo.com/ctxstuff/?ref=logparse-related-ctxstuff-readme) — stuff a repo into an LLM context\n- [`@v0idd0/promptdiff`](https://tools.voiddo.com/promptdiff/?ref=logparse-related-promptdiff-readme) — diff two prompts\n- [`@v0idd0/httpwut`](https://tools.voiddo.com/httpwut/?ref=logparse-related-httpwut-readme) — HTTP debugger\n- [`@v0idd0/gitstats`](https://tools.voiddo.com/gitstats/?ref=logparse-related-gitstats-readme) — local git analytics\n- [`@v0idd0/licenseme`](https://tools.voiddo.com/licenseme/?ref=logparse-related-licenseme-readme) — LICENSE generator + detector\n- [`@v0idd0/envguard`](https://tools.voiddo.com/envguard/?ref=logparse-related-envguard-readme) — .env validator + secret scanner\n- [`@v0idd0/depcheck`](https://tools.voiddo.com/depcheck/?ref=logparse-related-depcheck-readme) — offline CVE scanner + unused-deps\n\nFull catalog: [tools.voiddo.com](https://tools.voiddo.com/?ref=logparse-catalog-readme).\n\n## License\n\nMIT © [vøiddo](https://voiddo.com) — free forever, no asterisks.\n\n## Links\n\n- Docs: https://tools.voiddo.com/logparse/?ref=logparse-docs-readme\n- Source: https://github.com/voidd0/logparse\n- npm: https://npmjs.com/package/@v0idd0/logparse\n- Studio: https://voiddo.com/?ref=logparse-studio-readme\n- Issues: https://github.com/voidd0/logparse/issues\n- Support: support@voiddo.com\n\n---\n\nBuilt by [vøiddo](https://voiddo.com/) — a small studio shipping AI-flavoured products, free dev tools, Chrome extensions and weird browser games.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoidd0%2Flogparse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoidd0%2Flogparse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoidd0%2Flogparse/lists"}