Socket Source
The Vector socket
source
receives logs from socket
client.
Configuration
- Common
- Advanced
- vector.toml
- vector.yaml
- vector.json
[sources.my_source_id]type = "socket" # requiredaddress = "0.0.0.0:9000" # required, required when mode = `tcp` or `udp`max_length = 102400 # optional, default, bytesmode = "tcp" # requiredpath = "/path/to/socket" # required, required when mode = `unix`
- required*string
address
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.- Only required when: mode = `tcp` or `udp`
- View examples
- optionalstring
host_key
The key name added to each event representing the current host. This can also be globally set via the global [
host_key
](#host_key) option.- Default:
"host"
- Default:
- optionaltable
keepalive
Configures the TCP keepalive behavior for the connection to the source.
- optionaluint
time_secs
The time a connection needs to be idle before sending TCP keepalive probes.
- optionaluint
max_length
The maximum bytes size of incoming messages before they are discarded.
- Default:
102400
(bytes)
- Default:
- requiredstring
mode
The type of socket to use.
- Enum, must be one of:
"tcp"
"udp"
"unix_datagram"
"unix_stream"
- View examples
- Enum, must be one of:
- required*string
path
The unix socket path. This should be an absolute path.
- Only required when: mode = `unix`
- View examples
- optionaluint
shutdown_timeout_secs
The timeout before a connection is forcefully closed during shutdown.
- Only relevant when: mode = `tcp``
- Default:
30
(seconds)
- optionaltable
tls
Configures the TLS options for incoming connections.
- optionalstring
ca_file
Absolute path to an additional CA certificate file, in DER or PEM format (X.509), or an in-line CA certificate in PEM format.
- View examples
- optionalstring
crt_file
Absolute path to a certificate file used to identify this server, in DER or PEM format (X.509) or PKCS#12, or an in-line certificate in PEM format. If this is set, and is not a PKCS#12 archive,
key_file
must also be set. This is required ifenabled
is set totrue
.- View examples
- optionalbool
enabled
Require TLS for incoming connections. If this is set, an identity certificate is also required.
- Default:
false
- View examples
- Default:
- optionalstring
key_file
Absolute path to a private key file used to identify this server, in DER or PEM format (PKCS#8), or an in-line private key in PEM format.
- View examples
- optionalstring
key_pass
Pass phrase used to unlock the encrypted key file. This has no effect unless
key_file
is set.- View examples
- optionalbool
verify_certificate
If
true
, Vector will require a TLS certificate from the connecting host and terminate the connection if the certificate is not valid. Iffalse
(the default), Vector will not request a certificate from the client.- Default:
false
- View examples
- Default:
Output
This component outputs log events with the following fields:
{"host" : "my-host.local","message" : "2019-02-13T19:48:34+00:00 [info] Started GET \"/\" for 127.0.0.1","timestamp" : "2020-10-10T17:07:36+00:00"}
- requiredstring
host
The local hostname, equivalent to the
gethostname
command.- View examples
- requiredstring
message
The raw line, unparsed.
- View examples
- requiredtimestamp
timestamp
The exact time the event was ingested into Vector.
- View examples
Telemetry
This component provides the following metrics that can be retrieved through
the internal_metrics
source. See the
metrics section in the
monitoring page for more info.
- counter
connection_errors_total
The total number of connection errors for this Vector instance. This metric includes the following tags:
instance
- The Vector instance identified by host and port.job
- The name of the job producing Vector metrics.
- counter
processed_events_total
The total number of events processed by this component. This metric includes the following tags:
component_kind
- The Vector component kind.component_name
- The Vector component ID.component_type
- The Vector component type.file
- The file that produced the errorinstance
- The Vector instance identified by host and port.job
- The name of the job producing Vector metrics.
- counter
processed_bytes_total
The total number of bytes processed by the component. This metric includes the following tags:
component_kind
- The Vector component kind.component_name
- The Vector component ID.component_type
- The Vector component type.instance
- The Vector instance identified by host and port.job
- The name of the job producing Vector metrics.
Examples
Given the following input:
2019-02-13T19:48:34+00:00 [info] Started GET "/" for 127.0.0.1
And the following configuration:
[sources.socket]type = "socket"
The following Vector log event will be output:
{"timestamp": "2020-10-10T17:07:36.452332Z","message": "2019-02-13T19:48:34+00:00 [info] Started GET \"/\" for 127.0.0.1","host": "my-host.local"}
How It Works
Context
By default, the socket
source will augment events with helpful
context keys as shown in the "Output" section.
Transport Layer Security (TLS)
Vector uses Openssl for TLS protocols. You can
adjust TLS behavior via the tls.*
options.