Listens for incoming TCP or TLS connections and receives events.
accept_tcp endpoint:string, [tls=record, { … }]Description
Section titled “Description”Listens on the specified endpoint for incoming TCP connections. For each accepted connection, the operator spawns the nested pipeline and feeds it the bytes received from that connection.
endpoint: string
Section titled “endpoint: string”The endpoint to listen on. Must be of the form [tcp://]<hostname>:<port>. Use
0.0.0.0 as the host to accept connections on all interfaces.
tls = record (optional)
Section titled “tls = record (optional)”tls = record (optional)
Section titled “tls = record (optional)”TLS configuration. Provide an empty record (tls={}) to enable TLS with
defaults or set fields to customize it.
{ skip_peer_verification: bool, // skip certificate verification. cacert: string, // CA bundle to verify peers. certfile: string, // client certificate to present. keyfile: string, // private key for the client certificate. min_version: string, // minimum TLS version (`"1.0"`, `"1.1"`, `"1.2"`, "1.3"`). ciphers: string, // OpenSSL cipher list string. client_ca: string, // CA to validate client certificates. require_client_cert, // require clients to present a certificate.}The client_ca and require_client_cert options are only applied
for operators that accept incoming client connections, and otherwise
ignored.
Any value not specified in the record will either be picked up from the configuration or if not configured will not be used by the operator.
See the Node TLS Setup guide for more details.
{ … } (optional)
Section titled “{ … } (optional)”The pipeline to run for each individual TCP connection. If none is specified, no
transformations are applied to the output streams. Unless you are sure that
there is at most one active connection at a time, it is recommended to specify a
pipeline that parses the individual connection streams into events, for instance
{ read_json }. Otherwise, the output can be interleaved.
Inside the pipeline, the $peer variable is available as a record with the
following fields:
| Field | Type | Description |
|---|---|---|
ip | ip | The IP address of the connected peer |
port | int64 | The port number of the connected peer |
Examples
Section titled “Examples”Accept incoming JSON over TCP
Section titled “Accept incoming JSON over TCP”accept_tcp "0.0.0.0:8090" { read_json}Accept incoming Syslog over TCP
Section titled “Accept incoming Syslog over TCP”accept_tcp "0.0.0.0:514" { read_syslog}Accept connections with TLS
Section titled “Accept connections with TLS”accept_tcp "0.0.0.0:4443", tls={certfile: "cert.pem", keyfile: "key.pem"} { read_json}