HTTP Source

The Vector http source ingests data through the HTTP protocol and outputs log events.

Requirements

Configuration

vector.toml
[sources.my_source_id]
type = "http" # required
address = "0.0.0.0:80" # required
encoding = "text" # optional, default
headers = ["User-Agent", "X-My-Custom-Header"] # optional, no default
4 items
stringcommonrequired

address

The address to listen for connections on

No default
View examples
stringenumcommonoptional

encoding

The expected encoding of received data. Note that for json and ndjson encodings, the fields of the JSON objects are output as separate fields.

Default: "text"
Enum, must be one of: "text" "ndjson" "json"
View examples
[string]commonoptional

headers

A list of HTTP headers to include in the log event. These will override any values included in the JSON payload with conflicting names. An empty string will be inserted into the log event if the corresponding HTTP header was missing.

No default
View examples
tableoptional

tls

Configures the TLS options for connections from this source.

stringoptional

ca_path

Absolute path to an additional CA certificate file, in DER or PEM format (X.509).

No default
View examples
stringcommonoptional

crt_path

Absolute path to a certificate file used to identify this server, in DER or PEM format (X.509) or PKCS#12. If this is set and is not a PKCS#12 archive, key_path must also be set. This is required if enabled is set to true.

No default
View examples
boolcommonoptional

enabled

Require TLS for incoming connections. If this is set, an identity certificate is also required.

No default
View examples
stringcommonoptional

key_pass

Pass phrase used to unlock the encrypted key file. This has no effect unless key_path is set.

No default
View examples
stringcommonoptional

key_path

Absolute path to a certificate key file used to identify this server, in DER or PEM format (PKCS#8).

No default
View examples
booloptional

verify_certificate

If true, Vector will require a TLS certificate from the connecting host and terminate the connection if it is not valid. If false (the default), Vector will ignore the presence of a client certificate.

No default
View examples

Output

The http source ingests data through the HTTP protocol and outputs log events. For example:

{
"message": "This is one line from the plain text HTTP body",
"timestamp": "2019-11-01T21:15:47+00:00"
}

More detail on the output schema is below.

2 items
stringcommonrequired*

message

The message field, containing the plain text message.

Only required when: encoding = ["text"]
No default
View examples
timestampcommonrequired

timestamp

The time the event was ingested. Note this may be overridden by JSON payloads.

No default
View examples

How It Works

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.