Skip to content

Transport

Pinorama Transport is a Pino transport that streams log data to a Pinorama Server. It buffers logs in batches and sends them via the Pinorama Client with automatic retry on failure.

Installation

sh
npm i pinorama-transport
sh
pnpm i pinorama-transport
sh
yarn add pinorama-transport

Programmatic Usage

Use as a Pino transport in your Node.js application:

js
import pino from "pino"

const logger = pino({
  transport: {
    target: "pinorama-transport",
    options: {
      url: "http://localhost:3000/pinorama",
      adminSecret: "my-secret"
    }
  }
})

logger.info("hello from pinorama!")

With custom buffering options

js
const logger = pino({
  transport: {
    target: "pinorama-transport",
    options: {
      url: "http://localhost:3000/pinorama",
      batchSize: 50,
      flushInterval: 2000,
      maxRetries: 10
    }
  }
})

CLI Usage

The pino-pinorama CLI reads JSON logs from stdin and streams them to a Pinorama Server:

sh
node app.js | pino-pinorama --url http://localhost:3000/pinorama

CLI Options

pino-pinorama [options]
FlagAliasTypeDefaultDescription
--help-hDisplay help message
--version-vShow version
--url-ustringrequiredPinorama Server URL
--adminSecret-kstringServer admin secret
--batchSize-bnumber100Logs per bulk insert
--flushInterval-fnumber5000Flush interval in ms
--maxRetries-mnumber5Max retry attempts
--backoff-inumber1000Initial backoff time in ms
--backoffFactor-dnumber2Backoff multiplier
--backoffMax-xnumber30000Max backoff time in ms

Options

All options from both the Client and the transport itself:

OptionTypeDefaultDescription
urlstringrequiredPinorama Server URL
adminSecretstringServer admin secret
batchSizenumber100Number of logs to buffer before flushing
flushIntervalnumber5000Max time (ms) between flushes
maxRetriesnumber5Max retry attempts for failed inserts
backoffnumber1000Initial backoff time in ms
backoffFactornumber2Backoff multiplier per retry
backoffMaxnumber30000Maximum backoff time in ms

Buffering Behavior

The transport accumulates logs in an internal buffer and flushes when either condition is met:

  1. Batch size reached — When the buffer contains batchSize items, an immediate flush is triggered
  2. Flush interval elapsed — A timer fires every flushInterval milliseconds

On each flush, the transport pauses the input stream, sends the buffered logs via PinoramaClient.insert(), clears the buffer, and resumes the stream. A final flush is performed when the input stream ends.

Only valid JSON objects are accepted — non-object or empty-object lines are silently dropped.

Retry with Exponential Backoff

When a flush fails, the Pinorama Client retries with exponential backoff:

  1. First attempt fails — wait backoff ms (default: 1000ms)
  2. Second retry — wait backoff * backoffFactor ms (default: 2000ms)
  3. Third retry — wait backoff * backoffFactor^2 ms (default: 4000ms)
  4. Continues until maxRetries is reached or backoffMax is hit

The wait time is always capped at backoffMax (default: 30s). After exhausting all retries, the error is logged to stderr and the transport continues processing new logs.

Open Source ❤ MIT Licensed