Vector

Ship logs from Vector over HTTPS JSON, Splunk HEC or TCP SSL

Use Vector to collect logs from files, containers, syslog and other sources and send them to your Logit.io Logs stack. Vector can send over three routes today: the HTTPS JSON API, the Splunk HEC endpoint or a TCP SSL input. Start with HTTPS JSON unless you already use HEC or a TCP SSL input.

Logs

Install integration

Please click on the Install Integration button to configure your stack for this source.

Choose a route

RouteVector sinkUse it when
HTTPS JSONhttpYou want the simplest setup. One API key authenticates the request.
Splunk HECsplunk_hec_logsYou already send to Splunk. Change the endpoint and token, then turn compression and indexer acknowledgement off.
TCP SSLsocketYou prefer a persistent TLS connection to a Logstash TCP SSL input.

All three snippets are illustrative. They assume a source or transform named app_logs already exists. Replace inputs with your own component ID. To read log files, add a file source (opens in a new tab):

[sources.app_logs]
type = "file"
include = ["/var/log/*.log"]

Configure the sink

Send newline-delimited JSON to the /v2 endpoint. The key and endpoint populate in the example when you sign in and select a stack. Vector HTTP sink reference (opens in a new tab)

vector.toml
[sinks.logit_http]
type = "http"
inputs = ["app_logs"]
uri = "https://@logitApiEndpoint/v2"
method = "post"
compression = "none"
encoding.codec = "json"
framing.method = "newline_delimited"
batch.max_events = 1000
batch.max_bytes = 1000000
request.headers.ApiKey = "@apikey"

The settings that matter:

  • compression = "none" because the API rejects gzip-compressed bodies.
  • framing.method = "newline_delimited" sends NDJSON with Content-Type: application/x-ndjson, which the API accepts.
  • batch.max_events = 1000 matches the API's limit of 1,000 events per request.
  • batch.max_bytes = 1000000 keeps each request about 1 MB. Vector's default batch size for the http sink is larger than the API's 9,800,000-byte limit, so set it explicitly.
  • ApiKey is the recommended credential header. See JSON via HTTP/S for the other methods and for limits, response codes and retries.

Events from a file source carry file, host, message, source_type and timestamp fields. Use a remap transform (opens in a new tab) to add, rename or remove fields before the sink.

Validate and start Vector

Check the file without connecting to anything. --no-environment skips the health checks, so the command makes no network connections.

vector validate --no-environment vector.toml

Start Vector.

vector --config vector.toml

Vector batches events, so a log can take a few seconds to leave the host. For HTTPS JSON, HTTP 202 means the API has queued the events. They can take a short time to appear in OpenSearch.

Launch OpenSearch Dashboards to view your data

Launch OpenSearch Dashboards

How to diagnose no data in your stack

If you don't see data appearing in your stack after following this integration, take a look at the troubleshooting guide for steps to diagnose and resolve the problem or contact our support team and we'll be happy to assist.

Related guides