The Transmission Control Protocol (TCP) offers a bi-directional byte stream between applications that communicate via IP. Tenzir supports writing to and reading from TCP sockets, both in server (listening) and client (connect) mode.
Use the IP address 0.0.0.0 to listen on all available network interfaces.
SSL/TLS
Section titled “SSL/TLS”To enable TLS, pass tls={} to enable TLS with defaults or provide a record
with specific options like certfile and keyfile. Both
from_tcp and
load_tcp support server-side TLS for
accepting encrypted connections.
For testing purposes, you can quickly generate a self-signed certificate as follows:
openssl req -x509 -newkey rsa:2048 -keyout key_and_cert.pem -out key_and_cert.pem -days 365 -nodesAn easy way to test a TLS connection is to try connecting via OpenSSL:
openssl s_client 127.0.0.1:443Examples
Section titled “Examples”Listen for incoming JSON over TCP
Section titled “Listen for incoming JSON over TCP”from_tcp "0.0.0.0:8090" { read_json}Read data by connecting to a remote TCP server
Section titled “Read data by connecting to a remote TCP server”from "tcp://127.0.0.1:443", connect=true { read_json}Listen on localhost with TLS enabled
Section titled “Listen on localhost with TLS enabled”from_tcp "127.0.0.1:443", tls={certfile: "cert.pem", keyfile: "key.pem"} { read_json}