HTTP Source
The Vector http
source
receives logs from
HTTP.
Configuration
- Common
- Advanced
- vector.toml
- vector.yaml
- vector.json
[sources.my_source_id]type = "http" # requiredaddress = "0.0.0.0:80" # requiredencoding = "text" # optional, default
- requiredstring
address
The address to accept connections on. The address must include a port.
- View examples
- optionaltable
auth
Options for HTTP Basic Authentication.
- requiredstring
password
The basic authentication password.
- View examples
- requiredstring
username
The basic authentication user name.
- View examples
- optionalstring
encoding
The expected encoding of received data. Note that for
json
andndjson
encodings, the fields of the JSON objects are output as separate fields.- Default:
"text"
- Enum, must be one of:
"text"
"ndjson"
"json"
- View examples
- Default:
- optional[string]
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.
- View examples
- optional[string]
query_parameters
A list of URL query parameters to include in the log event. These will override any values included in the body with conflicting names.
- View examples
- 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:
{"message" : "Hello world","timestamp" : "2020-10-10T17:07:36+00:00"}
- required*string
message
The raw line line from the incoming payload.
- Only required when: encoding == "text"
- 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
http_bad_requests_total
The total number of HTTP
400 Bad Request
errors encountered. 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
- text/plain
- application/json
Given the following input:
Content-Type: text/plainUser-Agent: my-service/v2.1X-Forwarded-For: my-host.localHello world
And the following configuration:
[sources.http]type = "http"address = "0.0.0.0:80"encoding = "text"headers = ["User-Agent"]
The following Vector log event will be output:
[{"log": {"host": "my-host.local","message": "Hello world","timestamp": "2020-10-10T17:07:36.452332Z","User-Agent": "my-service/v2.1"}}]
How It Works
Context
By default, the http
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.