Socket

Example Configuration

Socket line

Config
Input
Output
1[sources.my_source_id]
2type = "socket"
1"2019-02-13T19:48:34+00:00 [info] Started GET \"/\" for 127.0.0.1"
1{
2 "log": {
3 "timestamp": "2020-10-10T17:07:36.452332Z",
4 "message": "2019-02-13T19:48:34+00:00 [info] Started GET \"/\" for 127.0.0.1",
5 "host": "my-host.local"
6 }
7}

Configuration Options

Required Options

address(required)

The address to listen for connections on, or systemd#N to use the Nth socket passed by systemd socket activation. If an address is used it must include a port.

TypeSyntaxDefaultExample
stringliteral["0.0.0.0:9000","systemd","systemd#3"]
mode(required)

The type of socket to use.

TypeSyntaxDefaultExample
stringliteral["tcp","udp","unix_datagram","unix_stream"]
path(required)

The unix socket path. This should be an absolute path.

TypeSyntaxDefaultExample
stringliteral["/path/to/socket"]
type(required)

The component type. This is a required field for all components and tells Vector which component to use.

TypeSyntaxDefaultExample
stringliteral["socket"]

Advanced Options

host_key(optional)

The key name added to each event representing the current host. This can also be globally set via the global host_key option.

TypeSyntaxDefaultExample
stringliteralhost
max_length(optional)

The maximum bytes size of incoming messages before they are discarded.

TypeSyntaxDefaultExample
uint102400
receive_buffer_bytes(optional)

Configures the receive buffer size using the SO_RCVBUF option on the socket.

TypeSyntaxDefaultExample
uint[65536]
keepalive(optional)

Configures the TCP keepalive behavior for the connection to the source.

TypeSyntaxDefaultExample
hash[]
tls(optional)

Configures the TLS options for incoming connections.

TypeSyntaxDefaultExample
hashliteral[]
shutdown_timeout_secs(optional)

The timeout before a connection is forcefully closed during shutdown.

TypeSyntaxDefaultExample
uint30

How it Works

State

This component is stateless, meaning its behavior is consistent across each input.

Transport Layer Security (TLS)

Vector uses OpenSSL for TLS protocols. You can adjust TLS behavior via the tls.* options.

Context

By default, the socket source augments events with helpful context keys.