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
npm i pinorama-transportpnpm i pinorama-transportyarn add pinorama-transportProgrammatic Usage
Use as a Pino transport in your Node.js application:
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
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:
node app.js | pino-pinorama --url http://localhost:3000/pinoramaCLI Options
pino-pinorama [options]| Flag | Alias | Type | Default | Description |
|---|---|---|---|---|
--help | -h | Display help message | ||
--version | -v | Show version | ||
--url | -u | string | required | Pinorama Server URL |
--adminSecret | -k | string | Server admin secret | |
--batchSize | -b | number | 100 | Logs per bulk insert |
--flushInterval | -f | number | 5000 | Flush interval in ms |
--maxRetries | -m | number | 5 | Max retry attempts |
--backoff | -i | number | 1000 | Initial backoff time in ms |
--backoffFactor | -d | number | 2 | Backoff multiplier |
--backoffMax | -x | number | 30000 | Max backoff time in ms |
Options
All options from both the Client and the transport itself:
| Option | Type | Default | Description |
|---|---|---|---|
url | string | required | Pinorama Server URL |
adminSecret | string | Server admin secret | |
batchSize | number | 100 | Number of logs to buffer before flushing |
flushInterval | number | 5000 | Max time (ms) between flushes |
maxRetries | number | 5 | Max retry attempts for failed inserts |
backoff | number | 1000 | Initial backoff time in ms |
backoffFactor | number | 2 | Backoff multiplier per retry |
backoffMax | number | 30000 | Maximum backoff time in ms |
Buffering Behavior
The transport accumulates logs in an internal buffer and flushes when either condition is met:
- Batch size reached — When the buffer contains
batchSizeitems, an immediate flush is triggered - Flush interval elapsed — A timer fires every
flushIntervalmilliseconds
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:
- First attempt fails — wait
backoffms (default: 1000ms) - Second retry — wait
backoff * backoffFactorms (default: 2000ms) - Third retry — wait
backoff * backoffFactor^2ms (default: 4000ms) - Continues until
maxRetriesis reached orbackoffMaxis 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.
