{"id":43626,"library":"pino-postgres","title":"pino-postgres","description":"pino-postgres is a pino transport that writes log entries to a PostgreSQL database. Version 0.0.41 is the latest stable release, last updated in 2020 with a low release cadence (no recent updates). It works as a command-line pipe transport, consuming pino NDJSON from stdin and inserting into a specified PostgreSQL table. Unlike other pino transports like pino-pretty (console output) or pino-elasticsearch (Elasticsearch), it targets PostgreSQL persistence without requiring a separate log shipper. It requires manual table creation with a jsonb column and offers configurable flush interval, buffer size, SSL support, and pass-through mode.","status":"active","version":"0.0.41","language":"javascript","source_language":"en","source_url":"https://github.com/aldis-ameriks/pino-postgres","tags":["javascript","pino","logging","log","nodejs","node","database","postgres","transport"],"install":[{"cmd":"npm install pino-postgres","lang":"bash","label":"npm"},{"cmd":"yarn add pino-postgres","lang":"bash","label":"yarn"},{"cmd":"pnpm add pino-postgres","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency - designed to work with pino logging library","package":"pino","optional":false},{"reason":"runtime dependency - PostgreSQL client driver","package":"pg","optional":false},{"reason":"runtime dependency - stream piping","package":"pump","optional":false},{"reason":"runtime dependency - splits NDJSON stream","package":"split2","optional":false}],"imports":[{"note":"pino-postgres is primarily used as a command-line transport piped from pino, not as a JavaScript API.","wrong":"","symbol":"pino-postgres CLI","correct":"npm install -g pino-postgres\nnode app.js | pino-postgres --connection postgres://localhost/mydb"}],"quickstart":{"code":"# Install pino and pino-postgres\nnpm install pino pino-postgres\n\n# Create a logs table in PostgreSQL\npsql -U postgres -d mydb -c \"CREATE TABLE logs (id SERIAL PRIMARY KEY, content JSONB NOT NULL, created_at TIMESTAMP DEFAULT NOW());\"\n\n# Pipe pino logs to pino-postgres\nnode -e \"const pino = require('pino'); const logger = pino(); logger.info('hello'); logger.error('world');\" | npx pino-postgres --connection postgres://postgres:password@localhost:5432/mydb --table logs --column content --flush-interval 1000 --buffer-size 100","lang":"javascript","description":"Demonstrates piping pino NDJSON logs to pino-postgres, requiring a pre-created PostgreSQL table with a jsonb column."},"warnings":[{"fix":"Run a CREATE TABLE statement manually (e.g., CREATE TABLE logs (id SERIAL PRIMARY KEY, content JSONB, created_at TIMESTAMP DEFAULT NOW()));","message":"pino-postgres does not create the database table automatically; you must create a table with a jsonb column before running the transport.","severity":"gotcha","affected_versions":"all"},{"fix":"Consider using alternative transports like pino-pretty, pino-roll, or writing a custom transport via pino.transport().","message":"The package has not been updated since 2020 and the repository appears unmaintained. It may not support newer versions of pino or pg.","severity":"deprecated","affected_versions":"latest"},{"fix":"Add --ssl to your pino-postgres command.","message":"SSL must be explicitly enabled with --ssl flag; without it, the connection will fail if PostgreSQL requires SSL.","severity":"gotcha","affected_versions":"all"},{"fix":"Set --flush-interval and --buffer-size according to your reliability needs, or use a more robust transport.","message":"The transport uses a buffer that flushes every --flush-interval milliseconds or when buffer size exceeds --buffer-size. Logs may be lost if the process crashes before flush.","severity":"gotcha","affected_versions":"all"},{"fix":"Add --column <your_column_name> to the command line.","message":"The column name is 'content' by default; if you have a different column name, you must specify --column.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'0.0.41':20 '2020':29 'buffer':98 'cadenc':34 'column':92 'command':43 'command-lin':42 'configur':95 'consol':67 'consum':47 'creation':88 'databas':18,113 'elasticsearch':72,73 'entri':14 'flush':96 'insert':53 'interv':97 'javascript':107 'jsonb':91 'last':26 'latest':23 'like':63 'line':44 'log':13,82,109,110 'low':32 'manual':86 'mode':106 'ndjson':49 'node':112 'nodej':111 'offer':94 'output':68 'pass':104 'pass-through':103 'persist':77 'pino':2,5,9,48,61,65,71,108 'pino-elasticsearch':70 'pino-postgr':1,4 'pino-pretti':64 'pipe':45 'postgr':3,6,114 'postgresql':17,57,76 'pretti':66 'recent':36 'releas':25,33 'requir':79,85 'separ':81 'shipper':83 'size':99 'specifi':56 'ssl':100 'stabl':24 'stdin':51 'support':101 'tabl':58,87 'target':75 'transport':10,46,62,115 'unlik':59 'updat':27,37 'version':19 'without':78 'work':39 'write':12","created_at":"2026-06-05T17:00:42.104614+00:00","updated_at":"2026-06-05T17:00:42.104614+00:00","problems":[{"fix":"Check the --connection string (e.g., postgres://user:pass@localhost:5432/mydb) and ensure PostgreSQL is accessible.","cause":"Connection string hostname is incorrect or DNS resolution fails.","error":"Error: getaddrinfo ENOTFOUND"},{"fix":"Create the table in advance: CREATE TABLE logs (id SERIAL PRIMARY KEY, content JSONB, created_at TIMESTAMP DEFAULT NOW());","cause":"The PostgreSQL table does not exist.","error":"error: relation \"logs\" does not exist"},{"fix":"Either rename your column to 'content' or specify the correct column with --column <name>.","cause":"The column name used (default 'content') is incorrect or table not created with that column.","error":"error: column \"content\" does not exist"},{"fix":"Add --ssl to the command line.","cause":"PostgreSQL requires SSL but the --ssl flag is not set.","error":"Error: self signed certificate"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/aldis-ameriks/pino-postgres#readme","github":"https://github.com/aldis-ameriks/pino-postgres","docs":null,"changelog":null,"pypi":null,"npm":"pino-postgres","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}