HttpTransportOptions
Define HttpTransport options.
Provide settings to configure HTTP endpoint, batching, retry, concurrency, and authentication for log delivery.
Extends
Section titled “Extends”TransportOptions
<Levels
>
Type Parameters
Section titled “Type Parameters”Levels
Section titled “Levels”Levels
extends Record
<string
, number
> = DEFAULT_LEVELS
mapping from level names to numeric priorities.
Properties
Section titled “Properties”
optional
auth:HttpAuth
Define authentication method for HTTP requests.
Default Value
Section titled “Default Value”HttpAuthNone
batchSize?
Section titled “batchSize?”
optional
batchSize:number
Number of log entries to batch per HTTP request.
Default Value
Section titled “Default Value”100
categories?
Section titled “categories?”
optional
categories:Set
<string
>
Set of categories to include. If provided, only logs whose meta.category matches one of these entries will be emitted.
Inherited from
Section titled “Inherited from”concurrency?
Section titled “concurrency?”
optional
concurrency:number
Maximum number of concurrent HTTP requests.
Default Value
Section titled “Default Value”10
context?
Section titled “context?”
optional
context:Record
<string
,unknown
>
Additional context for each log specific to the transport. Context object is deep-merged to the log objects. (e.g fields required by sink.)
Inherited from
Section titled “Inherited from”encoding?
Section titled “encoding?”
optional
encoding:BufferEncoding
Encoding for raw message writes (e.g., ‘utf8’, ‘utf16le’).
Inherited from
Section titled “Inherited from”filter()?
Section titled “filter()?”
optional
filter: (log
) =>boolean
Predicate to filter individual logs. Return false to drop the log. Executed in the main thread.
Parameters
Section titled “Parameters”Log
<Levels
>
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”flushInterval?
Section titled “flushInterval?”
optional
flushInterval:number
Interval in milliseconds to flush pending batches.
Default Value
Section titled “Default Value”5000
formatter?
Section titled “formatter?”
optional
formatter:FormatterOptions
<Levels
>
Formatter configuration describing output shape, serialization, and content type.
Inherited from
Section titled “Inherited from”headers?
Section titled “headers?”
optional
headers:Record
<string
,string
>
Include custom headers in each request.
Default Value
Section titled “Default Value”{ 'Content-Type': 'application/json' }
levels?
Section titled “levels?”
optional
levels:LevelName
<Levels
>[]
Explicit set of level names to include. If provided, only logs whose level name appears in this array will be emitted.
Inherited from
Section titled “Inherited from”logLevel?
Section titled “logLevel?”
optional
logLevel:number
Minimum numeric severity to accept. Logs below this level are dropped.
Inherited from
Section titled “Inherited from”method?
Section titled “method?”
optional
method:"POST"
|"PUT"
Specify HTTP method for sending logs.
Default Value
Section titled “Default Value”'POST'
optional
name:string
Human-readable name for this transport. Defaults to the transport class name.
Inherited from
Section titled “Inherited from”onError()?
Section titled “onError()?”
optional
onError: (err
) =>void
Handler invoked on any transport-level error. Receives a TransportError with details about the failure context.
Parameters
Section titled “Parameters”TransportError
<Levels
>
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”retry?
Section titled “retry?”
optional
retry:RetryOption
Configure retry behavior for failed HTTP calls.
runAsWorker?
Section titled “runAsWorker?”
optional
runAsWorker:boolean
Whether to offload log processing to a worker thread.
Inherited from
Section titled “Inherited from”transformer()?
Section titled “transformer()?”
optional
transformer: (log
) =>null
|Log
<Levels
>
Function to transform or drop logs. Return a new modified Log to proceed, or null to skip. Do not modify original log object to prevent side-effects.
Parameters
Section titled “Parameters”Log
<Levels
>
Returns
Section titled “Returns”null
| Log
<Levels
>
Inherited from
Section titled “Inherited from”url:
string
Target URL where logs will be delivered.
worker?
Section titled “worker?”
optional
worker:object
Worker-specific settings when runAsWorker is true:
- closeTimeout: ms to wait for worker to exit before aborting.
- readyTimeout: ms to wait for worker to signal ready.
- url: override URL of worker script.
- custom: factory function to create a Worker instance.
closeTimeout?
Section titled “closeTimeout?”
optional
closeTimeout:number
Timeout (ms) for the worker.close handshake. Default: 60000.
custom()?
Section titled “custom()?”
optional
custom: () =>Worker
Custom factory for instantiating the worker.
Returns
Section titled “Returns”Worker
readyTimeout?
Section titled “readyTimeout?”
optional
readyTimeout:number
Timeout (ms) for the worker ready handshake. Default: 30000.
optional
url:URL
Override the script URL for the worker.