HTTP

Example Configuration

text/plain

Config
Input
Output
1[sources.my_source_id]
2type = "http"
3headers = [ "User-Agent" ]
4encoding = "text"
5address = "0.0.0.0:80"
1"```http\nPOST / HTTP/1.1\nContent-Type: text/plain\nUser-Agent: my-service/v2.1\nX-Forwarded-For: my-host.local\n\nHello world\n```"
1[
2 {
3 "log": {
4 "host": "my-host.local",
5 "message": "Hello world",
6 "timestamp": "2020-10-10T17:07:36.452332Z",
7 "path": "/",
8 "User-Agent": "my-service/v2.1"
9 }
10 }
11]

application/json

Config
Input
Output
1[sources.my_source_id]
2type = "http"
3path_key = "vector_http_path"
4headers = [ "User-Agent" ]
5encoding = "json"
6address = "0.0.0.0:80"
1"```http\nPOST /events HTTP/1.1\nContent-Type: application/json\nUser-Agent: my-service/v2.1\nX-Forwarded-For: my-host.local\n{\"key\": \"val\"}\n```"
1[
2 {
3 "log": {
4 "host": "my-host.local",
5 "key": "val",
6 "timestamp": "2020-10-10T17:07:36.452332Z",
7 "User-Agent": "my-service/v2.1"
8 }
9 }
10]

Configuration Options

Required Options

address(required)

The address to accept connections on. The address must include a port.

TypeSyntaxDefaultExample
stringliteral["0.0.0.0:80","localhost:80"]
type(required)

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

TypeSyntaxDefaultExample
stringliteral["http"]

Advanced Options

acknowledgements(optional)

Controls if the source will wait for destination sinks to deliver the events before acknowledging receipt.

TypeSyntaxDefaultExample
bool
encoding(optional)

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

TypeSyntaxDefaultExample
stringliteraltext
headers(optional)

A list of HTTP headers to include in the log event. These will override any values included in the JSON payload with conflicting names.

TypeSyntaxDefaultExample
arrayliteral["User-Agent","X-My-Custom-Header"]
auth(optional)

Options for HTTP Basic Authentication.

TypeSyntaxDefaultExample
hashliteral[]
query_parameters(optional)

A list of URL query parameters to include in the log event. These will override any values included in the body with conflicting names.

TypeSyntaxDefaultExample
arrayliteral["application","source"]
path(optional)

The URL path on which log event POST requests shall be sent.

TypeSyntaxDefaultExample
stringliteral/["/event/path","/logs"]
strict_path(optional)

If set to true, only requests using the exact URL path specified in path will be accepted; otherwise requests sent to a URL path that starts with the value of path will be accepted. With strict_path set to false and path set to "", the configured HTTP source will accept requests from any URL path.

TypeSyntaxDefaultExample
bool
tls(optional)

Configures the TLS options for incoming connections.

TypeSyntaxDefaultExample
hashliteral[]
path_key(optional)

The event key in which the requested URL path used to send the request will be stored.

TypeSyntaxDefaultExample
stringliteralpath["vector_http_path"]

How it Works

Decompression

Received body is decompressed according to Content-Encoding header. Supported algorithms are gzip, deflate, and snappy.

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 http source augments events with helpful context keys.