Install Vector on NixOS

NixOS is a Linux distribution built on top of the Nix package manager. It uses declarative configuration and allows reliable system upgrades. This page will cover installing and managing Vector on the NixOS operating system.

Install

Nix
Vector daemon deployment strategyVector daemon deployment strategy
1. Your service logs to STDOUT
STDOUT follows the 12 factor principles.
2. STDOUT is captured
STDOUT is captured by your platform.
3. Vector collects & fans-out data
Vector collects data from your platform.

The agent role is designed to collect all data on a single host. Vector runs as a background process and interfaces with a host-level APIs for data collection. By default, Vector will collect logs from Journald via Vector's journald source and metrics via the host_metrics source, but it is recommended to adjust your pipeline as necessary using Vector's sources, transforms, and sinks.


  1. Install Vector

    nix-env --file https://github.com/NixOS/nixpkgs/archive/master.tar.gz --install --attr vector
  2. Configure Vector

    cat <<-'VECTORCFG' > /etc/vector/vector.toml
    # Vector's API for introspection
    [api]
    enabled = true
    address = "127.0.0.1:8686"
    # Host-level logs
    [sources.logs]
    type = "journald"
    # Host-level metrics (cpu, memory, disk, etc)
    [sources.host_metrics]
    type = "host_metrics"
    # Vector's own internal metrics
    [sources.internal_metrics]
    type = "internal_metrics"
    # --> Add transforms here to parse, enrich, and process data
    # print all events, replace this with your desired sink(s)
    # https://vector.dev/docs/reference/sinks/
    [sinks.out]
    type = "console"
    inputs = [ "logs", "host_metrics", "internal_metrics" ]
    encoding.codec = "json"
    VECTORCFG
  3. Start Vector

    vector --config /etc/vector/vector.toml
  4. Observe Vector

    vector top
    explain this command

Deployment

Vector is an end-to-end observability data platform designed to deploy under various roles. You mix and match these roles to create topologies. The intent is to make Vector as flexible as possible, allowing you to fluidly integrate Vector into your infrastructure over time. The deployment section demonstrates common Vector pipelines:

Common Deployment Pipelines

Administration

Nix

Start

vector --config /etc/vector/vector.toml
explain this command

Reload

killall -s SIGHUP vector
explain this command

Observe

vector top
explain this command

Upgrade

nix-env --file https://github.com/NixOS/nixpkgs/archive/master.tar.gz --upgrade vector
explain this command

Uninstall

Nix
nix-env --uninstall vector
explain this command