A Pino transport for MySQL and MariaDB databases. Current stable version is 1.3.0. This package allows piping Pino log output into a MySQL or MariaDB table. It supports mapping log fields to database columns, including JSON column type. The transport is designed to work as a standalone CLI utility consuming pino's NDJSON via stdin. It is useful for centralized logging in Node.js applications. Updates are infrequent; no major breaking changes since v1.0.0.
npm install pino-mysqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates installing pino-mysql, creating a log table, configuring column mappings, and piping pino output into the transport.
Ensure you pipe only pino log output (or any NDJSON) into the transport.
Verify the config JSON includes 'host', 'user', 'password', 'database', 'table', and 'columns'.
Set 'delimiter' in config if your log keys contain periods.
Use MySQL JSON column type or a large TEXT column.
Use a type assertion or declare module manually if using TypeScript.
Run 'npm install -g pino-mysql' or use 'npx pino-mysql' (note: npx may need network access to download).
Update mysql2 driver: 'npm install mysql2@latest' or alter MySQL user to use mysql_native_password: 'ALTER USER 'user'@'host' IDENTIFIED WITH mysql_native_password BY 'password';'
Verify that the table columns match the config columns exactly (including names and data types).