A lightweight Node.js library for parsing PostgreSQL logs in CSV format (csvlog). Current stable version is 1.0.2. It is a straightforward, dependency-free parser that converts PostgreSQL csvlog lines into JavaScript objects. Unlike manual parsing or regular expressions, this library handles the custom CSV escaping, quoting, and field types used by PostgreSQL's csvlog format, including timestamps, numeric, and error details. It parses each line according to the PostgreSQL documentation for log_destination='csvlog'. No dependencies, simple API, suitable for log analysis and monitoring tools. Released under the MIT license.
npm install postgres-csvlogNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Parses a single PostgreSQL csvlog line into an object with typed fields.
Split multiline logs by newline and parse each line separately.
Ensure input adheres to PostgreSQL csvlog format; consider validating with a regex prefix check.
For robust handling, use PostgreSQL's COPY command to export logs if possible.
Use `import parse from 'postgres-csvlog'` or `const parse = require('postgres-csvlog')`Ensure the log line is a non-empty string before calling parse.
No dependency data recorded yet.