Install Vector from source

This page covers installing Vector from source using the native toolchain for the host.

Vector can also be compiled to a static binary for Linux for x86_64, ARM64, and ARMv7 architectures. See compiling using Docker for details.

We recommend installing Vector through a supported platform, package manager, or pre-built archive if possible. These handle permissions, directory creation, and other intricacies covered in the Next Steps section.

Installation

Linux

Install Rust:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable

Install compilation dependencies, specifically C and C++ compilers (GCC or Clang) and GNU make if they aren’t pre-installed on your system.

Download Vector’s source:

# Latest (0.17.0)
mkdir -p vector && \
  curl -sSfL --proto '=https' --tlsv1.2 https://api.github.com/repos/vectordotdev/vector/tarball/v0.17.0 | \
  tar xzf - -C vector --strip-components=1

# Master
mkdir -p vector && \
  curl -sSfL --proto '=https' --tlsv1.2 https://github.com/vectordotdev/vector/archive/master.tar.gz | \
  tar xzf - -C vector --strip-components=1

Change into your Vector directory:

cd vector

Compile Vector:

[FEATURES="<flag1>,<flag2>,..."] make build

The FEATURES environment variable is optional. You can override the default features using this variable. See feature flags for more info.

When finished, the Vector binary is placed in target/<target>/release/vector. If you’re building Vector on your Mac, for example, the target triple is x86_64-apple-darwin and the Vector binary will be located at target/x86_64-apple-darwin/release/vector.

Finally, you can start Vector:

target/<target>/release/vector --config config/vector.toml

Windows

Install Rust using rustup. If you don’t have VC++ build tools, the install will prompt you to install them.

Install Perl for Windows.

Add Perl to your PATH. In a Rust/MSVC environment (for example using x64 Native Tools Command Prompt) add the binary directory of Perl installed on the previous step to PATH. For example, for default installation of Strawberry Perl it is

set PATH=%PATH%;C:\Strawberry\perl\bin

Get Vector’s source using Git:

# Latest
git clone https://github.com/vectordotdev/vector
git checkout v0.17.0
cd vector

# Master
git clone https://github.com/vectordotdev/vector
cd vector

Build Vector in release mode:

set RUSTFLAGS=-Ctarget-feature=+crt-static
cargo build --no-default-features --features default-msvc --release

Start Vector. After these steps, a binary vector.exe in target\release would be created. It can be started by running:

.\target\release\vector --config config\vector.toml

Docker

You can build statically linked binaries of Vector for Linux using [cross][] in Docker. If you do so, the dependencies listed in the previous section aren’t needed, as all of them would be automatically pulled by Docker.

First, download Vector’s source:

# Latest (0.17.0)
mkdir -p vector && \
  curl -sSfL --proto '=https' --tlsv1.2 https://api.github.com/repos/vectordotdev/vector/tarball/v0.17.0 | \
  tar xzf - -C vector --strip-components=1

# Master
mkdir -p vector && \
  curl -sSfL --proto '=https' --tlsv1.2 https://github.com/vectordotdev/vector/archive/master.tar.gz | \
  tar xzf - -C vector --strip-components=1

Second, install cross.

And then build Vector using [cross][]:

# Linux (x86_64)
PASS_FEATURES=default-cmake make package-x86_64-unknown-linux-musl-all

# Linux (ARM64)
PASS_FEATURES=default-cmake make package-aarch64-unknown-linux-musl-all

# Linux (ARMv7)
PASS_FEATURES=default-cmake make package-armv7-unknown-linux-muslueabihf-all

The command above builds a Docker image with a Rust toolchain for a Linux target for the corresponding architecture using musl as the C library, then starts a container from this image, and then builds inside the container. The target binary is located at target/<target triple>/release/vector as in the previous case.

Next steps

Configuring

The Vector configuration file is located at:

config/vector.toml

Example configurations are located in config/vector/examples/*. You can learn more about configuring Vector in the Configuration documentation.

Data directory

We recommend creating a data directory that Vector can use:

mkdir /var/lib/vector
Make sure that this directory is writable by the vector process.

Vector offers a global data_dir option that you can use to specify the path of your directory:

data_dir = "/var/lib/vector" # default

Service managers

Vector archives ship with service files in case you need them:

Init.d

To install Vector into Init.d, run:

cp -av etc/init.d/vector /etc/init.d

Systemd

To install Vector into Systemd, run:

cp -av etc/systemd/vector.service /etc/systemd/system

Updating

To update Vector, follow the same installation instructions above.

How it works

Feature flags

The following feature flags are supported via the FEATURES env var when executing make build:

[FEATURES="<flag1>,<flag2>,..."] make build

There are three meta-features that can be used when compiling for the corresponding targets. If no features are specified, the default is used.

FeatureDescriptionEnabled by default?
defaultDefault set of features for *-unknown-linux-gnu and *-apple-darwin targets.
default-cmakeDefault set of features for *-unknown-linux-* targets which uses cmake and perl as build dependencies.
default-msvcDefault set of features for *-pc-windows-msvc targets. Requires cmake and perl as build dependencies.

Alternatively, for finer control over dependencies and operating system features, it is possible to use specific features from the list below:

FeatureDescriptionIncluded in default feature?
unixEnables features that require cfg(unix) to be present on the platform, namely support for Unix domain sockets in the docker_logs source and jemalloc instead of the default memory allocator.
vendoredForces vendoring of OpenSSL and ZLib dependencies instead of using their versions installed in the system. Requires perl as a build dependency.
leveldb-plainEnables support for disk buffers using vendored LevelDB.
leveldb-cmakeThe same as leveldb-plain, but more portable. Requires cmake as a build dependency. Use this in case of compilation issues with leveldb-plain.
rdkafka-plainEnables vendored librdkafka dependency, which is required for the kafka source and kafka sink.
rdkafka-cmakeThe same as rdkafka-plain but more portable. Requires cmake as a build dependency. Use this in case of compilation issues with rdkafka-plain.

In addition, it is possible to pick only a subset of Vector’s components for the build using feature flags. In order to do it, it instead of default features one has to pass a comma-separated list of component features.

Vector component features

NameDescription
sources-apache_metricsEnables building the apache_metrics source
sources-aws_kinesis_firehoseEnables building the aws_kinesis_firehose source
sources-docker_logsEnables building the docker_logs source. Requires unix feature to be also enabled for support of Unix domain sockets.
sources-fileEnables building the file source.
sources-generatorEnables building the generator source
sources-host_metricsEnables building the host_metrics source
sources-httpEnables building the http source
sources-journaldEnables building the journald source
sources-kafkaEnables building the kafka source. Requires rdkafka-plain or rdkafka-cmake feature to be also enabled.
sources-kubernetes_logsEnables building the kubernetes_logs source
sources-heroku_logsEnables building the heroku_logs source
sources-prometheusEnables building the prometheus_scrape source
sources-socketEnables building the socket source
sources-splunk_hecEnables building the splunk_hec source
sources-statsdEnables building the statsd source
sources-stdinEnables building the stdin source
sources-syslogEnables building the syslog source
sources-vectorEnables building the vector source
transforms-dedupeEnables building the dedupe transform
transforms-filterEnables building the filter transform
transforms-geoipEnables building the geoip transform
transforms-log_to_metricEnables building the log_to_metric transform
transforms-luaEnables building the lua transform
transforms-metric_to_logEnables building the metric_to_log transform
transforms-reduceEnables building the reduce transform
transforms-remapEnables building the remap transform
transforms-sampleEnables building the sample transform
transforms-routeEnables building the route transform
transforms-tag_cardinality_limitEnables building the tag_cardinality_limit transform
sinks-aws_cloudwatch_logsEnables building the aws_cloudwatch_logs sink
sinks-aws_cloudwatch_metricsEnables building the aws_cloudwatch_metrics sink
sinks-aws_kinesis_firehoseEnables building the aws_kinesis_firehose sink
sinks-aws_kinesis_streamsEnables building the aws_kinesis_streams sink
sinks-aws_s3Enables building the aws_s3 sink
sinks-azure_monitor_logsEnables building the azure_monitor_logs sink
sinks-blackholeEnables building the blackhole sink
sinks-clickhouseEnables building the clickhouse sink
sinks-consoleEnables building the console sink
sinks-datadog_logsEnables building the datadog_logs sink
sinks-datadog_metricsEnables building the datadog_metrics sink
sinks-elasticsearchEnables building the elasticsearch sink
sinks-fileEnables building the file sink
sinks-gcp_cloud_storageEnables building the gcp_cloud_storage sink
sinks-gcp_pubsubEnables building the gcp_pubsub sink
sinks-gcp_stackdriver_logsEnables building the gcp_stackdriver_logs sink
sinks-honeycombEnables building the honeycomb sink
sinks-httpEnables building the http sink
sinks-humio_logsEnables building the humio_logs sink
sinks-humio_metricsEnables building the humio_metrics sink
sinks-influxdb_logsEnables building the influxdb_logs sink
sinks-influxdb_metricsEnables building the influxdb_metrics sink
sinks-kafkaEnables building the kafka sink. Requires rdkafka-plain or rdkafka-cmake feature to be also enabled.
sinks-logdnaEnables building the logdna sink
sinks-lokiEnables building the loki sink
sinks-new_relic_logsEnables building the new_relic_logs sink
sinks-papertrailEnables building the papertrail sink
sinks-prometheusEnables building the prometheus_exporter and prometheus_remote_write sinks
sinks-pulsarEnables building the pulsar sink
sinks-sematext_logsEnables building the sematext_logs sink
sinks-sematext_metricsEnables building the sematext_metrics sink
sinks-socketEnables building the socket sink
sinks-splunk_hecEnables building the splunk_hec_logs sink
sinks-statsdEnables building the statsd sink
sinks-vectorEnables building the vector sink