| description | Batches `log` events to a generic HTTP endpoint. |
|---|
The http sink batches log events to a generic HTTP endpoint.
{% code-tabs %} {% code-tabs-item title="vector.toml (simple)" %}
[sinks.my_sink_id]
# REQUIRED - General
type = "http" # must be: "http"
inputs = ["my-source-id"]
uri = "https://10.22.212.22:9000/endpoint"
# REQUIRED - requests
encoding = "ndjson" # enum: "ndjson" or "text"
# OPTIONAL - Batching
batch_size = 1049000 # default, bytes
batch_timeout = 5 # default, seconds{% endcode-tabs-item %} {% code-tabs-item title="vector.toml (advanced)" %}
[sinks.my_sink_id]
# REQUIRED - General
type = "http" # must be: "http"
inputs = ["my-source-id"]
uri = "https://10.22.212.22:9000/endpoint"
# REQUIRED - requests
encoding = "ndjson" # enum: "ndjson" or "text"
# OPTIONAL - General
healthcheck = true # default
healthcheck_uri = "https://10.22.212.22:9000/_health" # no default
# OPTIONAL - Batching
batch_size = 1049000 # default, bytes
batch_timeout = 5 # default, seconds
# OPTIONAL - Requests
rate_limit_duration = 1 # default, seconds
rate_limit_num = 10 # default
request_in_flight_limit = 10 # default
request_timeout_secs = 30 # default, seconds
retry_attempts = 10 # default
retry_backoff_secs = 10 # default, seconds
# OPTIONAL - Basic auth
[sinks.my_sink_id.basic_auth]
password = "password"
user = "username"
# OPTIONAL - Buffer
[sinks.my_sink_id.buffer]
type = "memory" # default, enum: "memory" or "disk"
max_size = 104900000 # no default, bytes, relevant when type = "disk"
num_items = 500 # default, events, relevant when type = "memory"
when_full = "block" # default, enum: "block" or "drop_newest"
# OPTIONAL - Headers
[sinks.my_sink_id.headers]
X-Powered-By = "Vector" # example
# OPTIONAL - Tls
[sinks.my_sink_id.tls]
ca_path = "/path/to/certificate_authority.crt" # no default
crt_path = "/path/to/host_certificate.crt" # no default
key_pass = "PassWord1" # no default
key_path = "/path/to/host_certificate.key" # no default
verify_certificate = true # default
verify_hostname = true # default{% endcode-tabs-item %} {% endcode-tabs %}
optional type: table
Options for basic authentication.
required type: string example: "password"
The basic authentication password.
required type: string example: "username"
The basic authentication user name.
optional default: 1049000 type: int unit: bytes
The maximum size of a batch before it is flushed. See Buffers & Batches for more info.
optional default: 5 type: int unit: seconds
The maximum age of a batch before it is flushed. See Buffers & Batches for more info.
optional type: table
Configures the sink specific buffer.
optional default: "memory" type: string
The buffer's type / location. disk buffers are persistent and will be retained between restarts.
The field is an enumeration and only accepts the following values:
| Value | Description |
|---|---|
"memory" (default) |
Stores the sink's buffer in memory. This is more performant (~3x), but less durable. Data will be lost if Vector is restarted abruptly. |
"disk" |
Stores the sink's buffer on disk. This is less performance (~3x), but durable. Data will not be lost between restarts. |
optional default: "block" type: string
The behavior when the buffer becomes full.
The field is an enumeration and only accepts the following values:
| Value | Description |
|---|---|
"block" (default) |
Applies back pressure when the buffer is full. This prevents data loss, but will cause data to pile up on the edge. |
"drop_newest" |
Drops new data as it's received. This data is lost. This should be used when performance is the highest priority. |
optional no default type: int unit: bytes example: 104900000
The maximum size of the buffer on the disk. Only relevant when type = "disk".
optional default: 500 type: int unit: events
The maximum number of events allowed in the buffer. Only relevant when type = "memory".
required type: string
The encoding format used to serialize the events before outputting.
The field is an enumeration and only accepts the following values:
| Value | Description |
|---|---|
"ndjson" |
Each event is encoded into JSON and the payload is new line delimited. |
"text" |
Each event is encoded into text via the message key and the payload is new line delimited. |
optional type: table
Options for custom headers.
required type: string example: X-Powered-By = "Vector"
A custom header to be added to each outgoing HTTP request.
optional default: true type: bool
Enables/disables the sink healthcheck upon start. See Health Checks for more info.
optional no default type: string example: "https://10.22.212.22:9000/_health"
A URI that Vector can request in order to determine the service health. See Health Checks for more info.
optional default: 1 type: int unit: seconds
The window used for the request_rate_limit_num option See Rate Limits for more info.
optional default: 10 type: int
The maximum number of requests allowed within the rate_limit_duration window. See Rate Limits for more info.
optional default: 10 type: int
The maximum number of in-flight requests allowed at any given time. See Rate Limits for more info.
optional default: 30 type: int unit: seconds
The maximum time a request can take before being aborted. It is highly recommended that you do not lower value below the service's internal timeout, as this could create orphaned requests, pile on retries, and result in deuplicate data downstream.
optional default: 10 type: int
The maximum number of retries to make for failed requests. See Retry Policy for more info.
optional default: 10 type: int unit: seconds
The amount of time to wait before attempting a failed request again. See Retry Policy for more info.
optional type: table
Configures the TLS options for connections from this sink.
optional no default type: string example: "/path/to/certificate_authority.crt"
Absolute path to an additional CA certificate file, in DER or PEM format (X.509).
optional no default type: string example: "/path/to/host_certificate.crt"
Absolute path to a certificate file used to identify this connection, 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.
optional no default type: string example: "/path/to/host_certificate.key"
Absolute path to a certificate key file used to identify this connection, in DER or PEM format (PKCS#8). If this is set, crt_path must also be set.
optional no default type: string example: "PassWord1"
Pass phrase used to unlock the encrypted key file. This has no effect unless key_pass above is set.
optional default: true type: bool
If true (the default), Vector will validate the TLS certificate of the remote host. Do NOT set this to false unless you understand the risks of not verifying the remote certificate.
optional default: true type: bool
If true (the default), Vector will validate the configured remote host name against the remote host's TLS certificate. Do NOT set this to false unless you understand the risks of not verifying the remote hostname.
required type: string example: "https://10.22.212.22:9000/endpoint"
The full URI to make HTTP requests to. This should include the protocol and host, but can also include the port, path, and any other valid part of a URI.
The http sink batches log up to the batch_size or
batch_timeout options. When flushed, Vector will write to a generic HTTP
endpoint. The encoding is dictated by the encoding option. For example:
POST <host>/_bulk HTTP/1.1
Host: <host>
Content-Type: application/x-ndjson
Content-Length: 654
{ "index" : { "_index" : "<index>" } }
{"timestamp": 1557932537, "message": "GET /roi/evolve/embrace/transparent", "host": "Stracke8362", "process_id": 914, "remote_addr": "30.163.82.140", "response_code": 504, "bytes": 29763}
{ "index" : { "_index" : "<index>" } }
{"timestamp": 1557933548, "message": "PUT /value-added/b2b", "host": "Wiza2458", "process_id": 775, "remote_addr": "30.163.82.140", "response_code": 503, "bytes": 9468}
{ "index" : { "_index" : "<index>" } }
{"timestamp": 1557933742, "message": "DELETE /reinvent/interfaces", "host": "Herman3087", "process_id": 775, "remote_addr": "43.246.221.247", "response_code": 503, "bytes": 9700}HTTP authentication is controlled via the Authorization header which you can
set with the headers option. For convenience, Vector also supports the
basic_auth.username and basic_auth.password options which handle setting the
Authorization header for the base access authentication
scheme.
The http sink buffers & batches data as
shown in the diagram above. You'll notice that Vector treats these concepts
differently, instead of treating them as global concepts, Vector treats them
as sink specific concepts. This isolates sinks, ensuring services disruptions
are contained and delivery guarantees are honored.
Batches are flushed when 1 of 2 conditions are met:
- The batch age meets or exceeds the configured
batch_timeout(default:5 seconds). - The batch size meets or exceeds the configured
batch_size(default:1049000 bytes).
Buffers are controlled via the buffer.* options.
This component offers an at least once delivery guarantee if your pipeline is configured to achieve this.
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.
Health checks ensure that the downstream service is accessible and ready to
accept data. This check is performed upon sink initialization.
In order to run this check you must provide a value for the healthcheck_uri
option.
If the health check fails an error will be logged and Vector will proceed to
start. If you'd like to exit immediately upon health check failure, you can
pass the --require-healthy flag:
vector --config /etc/vector/vector.toml --require-healthyAnd finally, if you'd like to disable health checks entirely for this sink
you can set the healthcheck option to false.
Vector offers a few levers to control the rate and volume of requests to the
downstream service. Start with the rate_limit_duration and rate_limit_num
options to ensure Vector does not exceed the specified number of requests in
the specified window. You can further control the pace at which this window is
saturated with the request_in_flight_limit option, which will guarantee no
more than the specified number of requests are in-flight at any given time.
Please note, Vector's defaults are carefully chosen and it should be rare that you need to adjust these. If you found a good reason to do so please share it with the Vector team by opening an issie.
Vector will retry failed requests (status == 429, >= 500, and != 501).
Other responses will not be retried. You can control the number of retry
attempts and backoff rate with the retry_attempts and retry_backoff_secs options.
The best place to start with troubleshooting is to check the
Vector logs. This is typically located at
/var/log/vector.log, then proceed to follow the
Troubleshooting Guide.
If the Troubleshooting Guide does not resolve your issue, please:
- Check for any open
http_sinkissues. - If encountered a bug, please file a bug report.
- If encountered a missing feature, please file a feature request.
- If you need help, join our chat/forum community. You can post a question and search previous questions.