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 container platform, package manager, or pre-built archive, if possible. These handle permissions, directory creation, and other intricacies covered in the Next Steps section.
Installation
Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stableInstall C++ toolchain
Install C and C++ compilers (GCC or Clang) and GNU
makeif they are not pre-installed on your system.Create the
vectordirectorymkdir vectorDownload Vector's Source
- Latest (0.6.0)
- Master
mkdir -p vector && \curl -sSfL --proto '=https' --tlsv1.2 https://api.github.com/repos/timberio/vector/tarball/v0.6.X | \tar xzf - -C vector --strip-components=1Change into the
vectordirectorycd vectorCompile Vector
[FEATURES="<flag1>,<flag2>,..."] make buildThe
FEATURESenvironment variable is optional. You can override the default features with this variable. See feature flags for more info.When finished, the vector binary will be placed in
target/<target>/release/vector. For example, if you are building Vector on your Mac, your target triple isx86_64-apple-darwin, and the Vector binary will be located attarget/x86_64-apple-darwin/release/vector.Start Vector
Finally, start vector:
target/<target>/release/vector --config config/vector.toml
Next Steps
Configuring
The Vector configuration file is located at:
config/vector.toml
A full spec is located at config/vector.spec.toml and examples are
located in config/vector/examples/*. You can learn more about configuring
Vector in the Configuration section.
Data Directory
We highly 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 distribution/init.d/vector /etc/init.d
Systemd
To install Vector into Systemd run:
cp -av distribution/systemd/vector.service /etc/systemd/system
Updating
Simply 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 which can be used when compiling for the corresponding targets. If no features
are specified, then the default one is used.
| Feature | Description | Enabled by default |
|---|---|---|
default | Default set of features for *-unknown-linux-gnu and *-apple-darwin targets. | |
default-musl | Default set of features for *-unknown-linux-musl targets. Requires 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, 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 docker 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 is more portable. Requires cmake as a build dependency. Use it in case of compilation issues with leveldb-plain. | |
rdkafka-plain | Enables vendored librdkafka dependency, which is required for kafka source and kafka sink. | |
rdkafka-cmake | The same as rdkafka-plain, but is more portable. Requires cmake as a build dependency. Use it in case of compilation issues with rdkafka-plain. |
Compiling using Docker
It is possible to build statically linked binaries of Vector for Linux using Docker.
In this case the dependencies listed in the previous section are not needed, as all of them would be automatically pulled by Docker.
Building steps:
Download Vector's Source
- Latest (0.6.0)
- Master
mkdir -p vector && \curl -sSfL --proto '=https' --tlsv1.2 https://api.github.com/repos/timberio/vector/tarball/v0.6.X | \tar xzf - -C vector --strip-components=1Build Vector using Docker
- Linux (x86_64)
- Linux (ARM64)
- Linux (ARMv7)
PASS_FEATURES=default-musl ./scripts/docker-run.sh builder-x86_64-unknown-linux-musl make buildThe command above builds a Docker image with Rust toolchain for a Linux target for the corresponding architecture using
muslas the C library, then starts a container from this image, and then builds inside the Container. The target binary is located intarget/<target triple>/release/vectorlike in the previous case.