TCP Logger Configuration
The tcp-logger plugin sends gateway request and response logs as JSON batches to TCP collectors with customizable formats and retry controls. Configuration covers plugin parameters and plugin metadata.
Parameters
See plugin common configurations for configuration options available to all plugins.
host
Hostname or IP address of the TCP collector.
port
valid value:
greater than or equal to 0Port of the TCP collector.
tls
If true, encrypt the collector connection with TLS. The plugin does not verify the collector certificate.
tls_options
Server name sent during the TLS handshake.
timeout
valid value:
greater than or equal to 1Collector connection and send timeout in milliseconds.
log_format
Custom log entry using key-value pairs. Values can reference built-in variables. Configuring this field replaces the default format.
APISIX supports nested structures up to five levels and truncates deeper content. API7 Gateway 3.9.23 and 3.10.10 support flat structures.
A plugin-instance value takes precedence over plugin metadata.
log_format_extra
Fields added to the default log entry. Existing default fields are not overwritten, and this field is ignored when
log_formatis configured.A plugin-instance value, including an empty object, takes precedence over plugin metadata.
include_req_body
If true, collect the request body for the default log entry.
include_req_body_expr
valid value:
at least one conditionAPISIX expressions controlling when the request body is collected. Used only when
include_req_bodyis true.include_resp_body
If true, collect the response body for the default log entry.
include_resp_body_expr
valid value:
at least one conditionAPISIX expressions controlling when the response body is collected. Used only when
include_resp_bodyis true.max_req_body_bytes
valid value:
greater than or equal to 1Maximum request-body bytes included in a log entry. Longer bodies are truncated. Not available in API7 Gateway 3.9.23.
max_resp_body_bytes
valid value:
greater than or equal to 1Maximum response-body bytes included in a log entry. Longer bodies are truncated. Not available in API7 Gateway 3.9.23.
name
Batch-processor identifier exported in batch-processing metrics.
batch_max_size
valid value:
greater than or equal to 1Entries in one batch. A value of 1 sends each entry immediately as one JSON object; larger batches are JSON arrays.
Batch processors are local to each gateway worker, so requests handled by different workers can be sent in separate batches.
inactive_timeout
valid value:
greater than or equal to 1Seconds without a new entry before the current batch is sent. Must be less than
buffer_duration.buffer_duration
valid value:
greater than or equal to 1Maximum age in seconds of the oldest entry before a batch is sent.
retry_delay
valid value:
greater than or equal to 0Seconds between failed send attempts.
max_retry_count
valid value:
greater than or equal to 0Failed retries allowed before a batch is dropped.
Plugin Metadata
log_format
Default custom format for plugin instances that do not configure
log_format.log_format_extra
Default additional fields for plugin instances that do not configure
log_format_extra.max_pending_entries
valid value:
greater than or equal to 1Maximum queued entries. New entries are discarded when the backlog reaches this limit.