PostHogLogsConfig

Properties

NameType
beforeSendBeforeSendLogFn | BeforeSendLogFn[]

Pre-send filter. See for shape and examples. Configure as a single function or a chain.

environmentstring

Deployment environment attached as OTLP deployment.environment (e.g. 'production', 'staging', 'dev').

flushIntervalMsnumber

How often the periodic background flush fires (ms). Records also flush eagerly when the buffer fills, on AppState changes (RN), and on shutdown(). Lower values trade battery/bandwidth for fresher data. Default: 10000 (RN) / 3000 (browser).

maxBatchRecordsPerPostnumber

Max records per outbound POST. Keeps each request under the server's 2 MB cap. On a 413 response, the SDK halves this value, retries the same records, then ramps back up by 1 per healthy send. A 413 on a single-record batch drops the record (it's larger than the server can accept regardless of batch size). Default: 50 (RN) / 100 (browser).

maxBufferSizenumber

Max records held in memory before the queue evicts the oldest on push (FIFO). Bounds memory footprint and on-disk-queue size. When the buffer hits this size, an immediate flush is triggered to reclaim space; if the flush hasn't completed before the next capture, the oldest record is shifted out. Default: 100.

rateCap{ maxLogs?: number; windowMs?: number; }

Tumbling-window rate cap. Bounds how many records can be captured within a sliding (technically tumbling) time window. Records exceeding the cap are dropped synchronously at captureLog() (they never enter the buffer or consume bandwidth). A single warn line is logged per window when the cap is hit. Defaults are per-SDK; on RN the default is { maxLogs: 500, windowMs: 10000 } (≈50 logs/sec ceiling, tuned for cellular bandwidth).

resourceAttributesRecord<string, LogAttributeValue>

Extra OTLP resource attributes attached to every record. Spread first; SDK-controlled keys (service.name, telemetry.sdk.*, RN's os.*) are layered on top so users cannot accidentally clobber them. Use the dedicated serviceName / environment / serviceVersion fields to override those keys.

serviceNamestring

Service name attached to every record as the OTLP service.name resource attribute. Used by the Logs UI for filtering / grouping. Default: 'unknown_service'.

serviceVersionstring

Service version attached as OTLP service.version. Useful for correlating regressions to specific app releases.

Community questions

Questions about this page? or post a community question.