npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

lduck

v0.0.7

Published

Pipe-friendly JSON log viewer powered by DuckDB

Downloads

615

Readme

lduck

Pipe-friendly JSON log viewer powered by DuckDB. Reads JSON lines from stdin or HTTP, stores them in DuckDB, and serves a real-time search UI.

Install

npm install -g lduck

Quick Start

Pipe any JSON-lines output into lduck:

kubectl logs -f deploy/api | lduck
cat app.log | lduck --port 9090
docker logs -f myapp | lduck --db ./logs.duckdb

Then open http://localhost:8080 in your browser.

Features

  • Full-text search across all log fields
  • Filter by level, service, host, source, and time range
  • Faceted navigation with custom facet support
  • Live tail via WebSocket (with polling fallback)
  • Raw SQL queries against DuckDB
  • CSV / JSON export
  • HTTP ingestion endpoint for batch log submission
  • In-memory by default, optional file-based persistence

CLI Options

Usage: <command> | lduck [options]

Options:
  -p, --port <port>       Server port (default: 8080)
  -m, --max-rows <n>      Maximum rows to keep (default: 100000)
      --batch-size <n>    Batch INSERT size (default: 5000)
      --db <path>         DuckDB persistence path (default: :memory:)
      --no-ui             Disable Web UI, API server only
  -h, --help              Show this help message

JSON Format

Each line should be a JSON object. lduck normalizes common field names automatically:

| Field | Aliases | |-------|---------| | timestamp | ts, time, @timestamp, datetime | | level | severity, loglevel, lvl, priority | | message | msg, body, text | | service | svc, app, component, logger | | trace_id | traceId, request_id, correlation_id | | host | | | duration_ms | | | source | |

Unrecognized fields are preserved in _raw and searchable via raw SQL.

HTTP Ingestion

You can also send logs via HTTP instead of stdin:

# Single log
curl -X POST http://localhost:8080/api/ingest \
  -H 'Content-Type: application/json' \
  -d '{"level":"INFO","message":"hello from curl","service":"my-app"}'

# Batch
curl -X POST http://localhost:8080/api/ingest \
  -H 'Content-Type: application/json' \
  -d '[{"level":"INFO","message":"log 1"},{"level":"ERROR","message":"log 2"}]'

API

| Method | Endpoint | Description | |--------|----------|-------------| | GET | /api/health | Health check with uptime | | GET | /api/logs | Query logs (supports search, level, service, source, startTime, endTime, limit, offset, order) | | GET | /api/stats | Log statistics by level | | GET | /api/facets | Facet value distribution | | GET | /api/schema | Database schema | | POST | /api/ingest | Ingest JSON logs (single object or array) | | POST | /api/query | Execute raw SQL | | POST | /api/export | Export logs as CSV or JSON | | WS | /api/ws/tail | Live tail WebSocket |

Development

git clone https://github.com/syumai/lduck.git
cd lduck
pnpm install
pnpm dev            # Start Vite dev server
pnpm test           # Run tests
pnpm lint           # Lint + type check
pnpm build          # Build for production

Test Log Generation

# stdout (pipe to lduck)
pnpm generate-logs | lduck

# relay (send to running lduck instance)
pnpm generate-logs | lduck relay --url http://localhost:8080

License

MIT