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.
{{< warning >}} 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. {{< /warning >}}
Installation
Linux
Install Rust:
1curl --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:
1# Latest ({{< version >}})
2mkdir -p vector && \
3 curl -sSfL --proto '=https' --tlsv1.2 https://api.github.com/repos/timberio/vector/tarball/v{{< version >}} | \
4 tar xzf - -C vector --strip-components=1
5
6# Master
7mkdir -p vector && \
8 curl -sSfL --proto '=https' --tlsv1.2 https://github.com/timberio/vector/archive/master.tar.gz | \
9 tar xzf - -C vector --strip-components=1
Change into your Vector directory:
1cd vector
Compile Vector:
1[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:
1target/<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
1set PATH=%PATH%;C:\Strawberry\perl\bin
Get Vector's source using Git:
1# Latest
2git clone https://github.com/timberio/vector
3git checkout v{{< version >}}
4cd vector
5
6# Master
7git clone https://github.com/timberio/vector
8cd vector
Build Vector in release mode:
1set RUSTFLAGS=-Ctarget-feature=+crt-static
2cargo 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:
1.\target\release\vector --config config\vector.toml
Docker
You can build statically linked binaries of Vector for Linux using 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:
1# Latest ({{< version >}})
2mkdir -p vector && \
3 curl -sSfL --proto '=https' --tlsv1.2 https://api.github.com/repos/timberio/vector/tarball/v{{< version >}} | \
4 tar xzf - -C vector --strip-components=1
5
6# Master
7mkdir -p vector && \
8 curl -sSfL --proto '=https' --tlsv1.2 https://github.com/timberio/vector/archive/master.tar.gz | \
9 tar xzf - -C vector --strip-components=1
Then build Vector using Docker:
1# Linux (x86_64)
2PASS_FEATURES=default-cmake ./scripts/docker-run.sh builder-x86_64-unknown-linux-musl make build
3
4# Linux (ARM64)
5PASS_FEATURES=default-cmake ./scripts/docker-run.sh builder-aarch64-unknown-linux-musl make build
6
7# Linux (ARMv7)
8PASS_FEATURES=default-cmake ./scripts/docker-run.sh builder-armv7-unknown-linux-musleabihf make build
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:
1config/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:
1mkdir /var/lib/vector
{{< warning >}}
Make sure that this directory is writable by the vector
process.
{{< /warning >}}
Vector offers a global data_dir
option that you can use to specify the path of your directory:
1data_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:
1cp -av etc/init.d/vector /etc/init.d
Systemd
To install Vector into Systemd, run:
1cp -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
:
1[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.
Feature | Description | Enabled by default? |
---|---|---|
default | Default set of features for *-unknown-linux-gnu and *-apple-darwin targets. | ✅ |
default-cmake | Default set of features for *-unknown-linux-* targets which uses cmake and perl as build dependencies. | |
default-msvc | Default 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:
Feature | Description | Included in default feature? |
---|---|---|
unix | Enables 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. | ✅ |
vendored | Forces vendoring of OpenSSL and ZLib dependencies instead of using their versions installed in the system. Requires perl as a build dependency. | ✅ |
leveldb-plain | Enables support for disk buffers using vendored LevelDB. | ✅ |
leveldb-cmake | The same as leveldb-plain , but more portable. Requires cmake as a build dependency. Use this in case of compilation issues with leveldb-plain . | |
rdkafka-plain | Enables vendored librdkafka dependency, which is required for the kafka source and kafka sink. | ✅ |
rdkafka-cmake | The 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.
{{< details title="Click to see all component features" >}}
Vector component features
Name | Description |
---|---|
sources-apache_metrics | Enables building the apache_metrics source |
sources-aws_kinesis_firehose | Enables building the aws_kinesis_firehose source |
sources-docker_logs | Enables building the docker_logs source. Requires unix feature to be also enabled for support of Unix domain sockets. |
sources-file | Enables building the file source. |
sources-generator | Enables building the generator source |
sources-host_metrics | Enables building the host_metrics source |
sources-http | Enables building the http source |
sources-journald | Enables building the journald source |
sources-kafka | Enables building the kafka source. Requires rdkafka-plain or rdkafka-cmake feature to be also enabled. |
sources-kubernetes_logs | Enables building the kubernetes_logs source |
sources-heroku_logs | Enables building the heroku_logs source |
sources-prometheus | Enables building the prometheus_scrape source |
sources-socket | Enables building the socket source |
sources-splunk_hec | Enables building the splunk_hec source |
sources-statsd | Enables building the statsd source |
sources-stdin | Enables building the stdin source |
sources-syslog | Enables building the syslog source |
sources-vector | Enables building the vector source |
transforms-dedupe | Enables building the dedupe transform |
transforms-filter | Enables building the filter transform |
transforms-geoip | Enables building the geoip transform |
transforms-log_to_metric | Enables building the log_to_metric transform |
transforms-lua | Enables building the lua transform |
transforms-metric_to_log | Enables building the metric_to_log transform |
transforms-reduce | Enables building the reduce transform |
transforms-remap | Enables building the remap transform |
transforms-sample | Enables building the sample transform |
transforms-route | Enables building the route transform |
transforms-tag_cardinality_limit | Enables building the tag_cardinality_limit transform |
sinks-aws_cloudwatch_logs | Enables building the aws_cloudwatch_logs sink |
sinks-aws_cloudwatch_metrics | Enables building the aws_cloudwatch_metrics sink |
sinks-aws_kinesis_firehose | Enables building the aws_kinesis_firehose sink |
sinks-aws_kinesis_streams | Enables building the aws_kinesis_streams sink |
sinks-aws_s3 | Enables building the aws_s3 sink |
sinks-azure_monitor_logs | Enables building the azure_monitor_logs sink |
sinks-blackhole | Enables building the blackhole sink |
sinks-clickhouse | Enables building the clickhouse sink |
sinks-console | Enables building the console sink |
sinks-datadog_logs | Enables building the datadog_logs sink |
sinks-datadog_metrics | Enables building the datadog_metrics sink |
sinks-elasticsearch | Enables building the elasticsearch sink |
sinks-file | Enables building the file sink |
sinks-gcp_cloud_storage | Enables building the gcp_cloud_storage sink |
sinks-gcp_pubsub | Enables building the gcp_pubsub sink |
sinks-gcp_stackdriver_logs | Enables building the gcp_stackdriver_logs sink |
sinks-honeycomb | Enables building the honeycomb sink |
sinks-http | Enables building the http sink |
sinks-humio_logs | Enables building the humio_logs sink |
sinks-humio_metrics | Enables building the humio_metrics sink |
sinks-influxdb_logs | Enables building the influxdb_logs sink |
sinks-influxdb_metrics | Enables building the influxdb_metrics sink |
sinks-kafka | Enables building the kafka sink. Requires rdkafka-plain or rdkafka-cmake feature to be also enabled. |
sinks-logdna | Enables building the logdna sink |
sinks-loki | Enables building the loki sink |
sinks-new_relic_logs | Enables building the new_relic_logs sink |
sinks-papertrail | Enables building the papertrail sink |
sinks-prometheus | Enables building the prometheus_exporter and prometheus_remote_write sinks |
sinks-pulsar | Enables building the pulsar sink |
sinks-sematext_logs | Enables building the sematext_logs sink |
sinks-sematext_metrics | Enables building the sematext_metrics sink |
sinks-socket | Enables building the socket sink |
sinks-splunk_hec | Enables building the splunk_hec sink |
sinks-statsd | Enables building the statsd sink |
sinks-vector | Enables building the vector sink |
{{< /details >}} |