Transport
Pinorama Transport is a Pino transport that streams log data to Pinorama Server. It buffers logs in batches and sends them via 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 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 | 1000 | 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 |
--maxBufferSize | -s | number | 10000 | Max buffer size before dropping old logs |
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 | 1000 | Max time (ms) between flushes |
maxBufferSize | number | 10000 | Maximum buffer size before dropping oldest logs |
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.
Buffer Overflow
When the buffer exceeds maxBufferSize, the oldest logs are dropped to keep the buffer within the limit. This prevents unbounded memory growth when the server is unreachable or slow to respond. The default limit is 10,000 entries.
Retry with Exponential Backoff
When a flush fails, Pinorama Client retries with exponential backoff. After exhausting all retries, the error is logged to stderr and the transport continues processing new logs.
Retry sequence
- 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).
