LOG

tcp source

The tcp source ingests data through the TCP protocol and outputs log events.

Configuration

  • Common
  • Advanced
vector.toml
[sources.my_source_id]
type = "tcp" # example, must be: "tcp"
address = "0.0.0.0:9000" # example

Options

4 items
commonstringrequired

address

The address to listen for connections on, or "systemd#N" to use the Nth socket passed by systemd socket activation.

No default
View examples
stringoptional

host_key

The key name added to each event representing the current host. See Context for more info.

Default: "host"
View examples
intbytesoptional

max_length

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

Default: 102400
View examples
intsecondsoptional

shutdown_timeout_secs

The timeout before a connection is forcefully closed during shutdown.

Default: 30
View examples

Output

This component outputs log events.

Given the following input:

2019-02-13T19:48:34+00:00 [info] Started GET "/" for 127.0.0.1

A log event will be output with the following structure:

{
"timestamp": <current_timestamp>,
"message": "2019-02-13T19:48:34+00:00 [info] Started GET "/" for 127.0.0.1",
"host": "<upstream_hostname>"
}

More detail on the output schema is below.

3 items
stringrequired

host

The upstream hostname.

No default
View examples
stringrequired

message

The raw message, unaltered.

No default
View examples
timestamprequired

timestamp

The exact time the event was ingested.

No default
View examples

How It Works

Context

By default, the tcp source will add context keys to your events via thehost_key options.

Environment Variables

Environment variables are supported through all of Vector's configuration. Simply add ${MY_ENV_VAR} in your Vector configuration file and the variable will be replaced before being evaluated.

You can learn more in the Environment Variables section.

Line Delimiters

Each line is read until a new line delimiter (the 0xA byte) is found.