On this page
- What does Vector do in a monitoring setup?
- How do I install Vector on Ubuntu or Debian?
- How do I write a first pipeline for journal logs and host metrics?
- How do I check the config and confirm data is flowing?
- How can VRL parse application logs?
- How do I forward everything to a central Vector over TLS?
- How do I keep the API and exporter ports private?
- What are the usual problems and their fixes?
- Questions
What does Vector do in a monitoring setup?
Vector is a single binary that moves observability data: it reads logs and metrics from sources, changes them in transforms and writes them to sinks. One agent on each server can replace several shippers, sending logs to Loki or Graylog and metrics to Prometheus at the same time.
The pieces are easy to name:
- Sources: the systemd journal, files, syslog, Docker, host metrics, or another Vector instance.
- Transforms:
remapwith the Vector Remap Language (VRL) to parse and rename fields,filterto drop noise,sampleorthrottleto cut volume. - Sinks: files, the console, a Prometheus exporter, Loki, HTTP endpoints, object stores and more.
It is written in Rust and stays light, so it runs comfortably on a 1 GB plan as an agent. A central aggregator handling many servers benefits from 2 vCPUs and NVMe disk for buffers. Vector covers what happens inside the OS; the console Usage graphs tab keeps an outside view of CPU, disk and network for each instance.
How do I install Vector on Ubuntu or Debian?
The project publishes an apt repository and a setup script that adds it with the signing key. Review the script first if you like, then run it and install the package:
curl -sL https://setup.vector.dev -o /tmp/vector-setup.sh
less /tmp/vector-setup.sh
sudo bash /tmp/vector-setup.sh
sudo apt install -y vector
vector --versionThe package creates a vector system user, a systemd unit and a sample config at /etc/vector/vector.yaml, with state kept in /var/lib/vector. To read the journal and files in /var/log, add the service user to the matching groups:
sudo usermod -aG systemd-journal,adm vector
id vectorLater updates arrive with sudo apt upgrade. Read the release notes before a jump of several versions, because component options are occasionally renamed; vector validate will tell you if your file needs changes.
How do I write a first pipeline for journal logs and host metrics?
Replace the sample file with a small, readable pipeline. It reads the journal and basic host metrics, tidies the log events and exposes metrics for Prometheus on loopback:
sudo nano /etc/vector/vector.yamldata_dir: /var/lib/vector
api:
enabled: true
address: 127.0.0.1:8686
sources:
journal:
type: journald
current_boot_only: true
host:
type: host_metrics
scrape_interval_secs: 15
collectors: [cpu, memory, disk, filesystem, load, network]
transforms:
tidy:
type: remap
inputs: [journal]
source: |
.unit = ._SYSTEMD_UNIT
.level = .PRIORITY
del(.__CURSOR)
del(._BOOT_ID)
no_debug:
type: filter
inputs: [tidy]
condition: |
.level != "7"
sinks:
local_file:
type: file
inputs: [no_debug]
path: /var/lib/vector/out/journal-%Y-%m-%d.log
encoding:
codec: json
prom:
type: prometheus_exporter
inputs: [host]
address: 127.0.0.1:9598The remap block copies journal fields to short names and drops ones you will never query; the filter removes debug level lines. Each sink lists the components it reads from in inputs, which is how the graph of the pipeline is defined.
How do I check the config and confirm data is flowing?
Create the output folder for the file sink, then validate; the command checks syntax, the VRL programs and that every input exists:
sudo install -d -o vector -g vector /var/lib/vector/out
sudo -u vector vector validate /etc/vector/vector.yaml
sudo systemctl restart vector
systemctl status vector --no-pagerThen look at live counters. vector top connects to the API on 127.0.0.1:8686 and shows events in and out per component:
vector topConfirm both outputs directly:
sudo tail -n 3 /var/lib/vector/out/journal-$(date +%Y-%m-%d).log
curl -s http://127.0.0.1:9598/metrics | grep host_load1The first command prints JSON lines with unit and level fields; the second returns the current one minute load. If Prometheus runs on the same server, add 127.0.0.1:9598 as a scrape target. Service logs for Vector itself are in the journal: journalctl -u vector -n 50, as covered in the journalctl guide.
How can VRL parse application logs?
VRL is a small, safe language for reshaping events. Functions that can fail end with ! to abort on error, or are called with an error variable to handle failure gracefully. A common job is turning Nginx access lines into fields:
sources:
nginx_access:
type: file
include: [/var/log/nginx/access.log]
transforms:
nginx_parsed:
type: remap
inputs: [nginx_access]
source: |
parsed, err = parse_nginx_log(.message, "combined")
if err == null {
. = merge(., parsed)
.status = to_int(.status) ?? 0
}Test VRL snippets interactively before deploying them with vector vrl, which opens a REPL where you paste an event and run expressions against it. Keep transforms small and named after what they do; a pipeline of three clear steps is easier to debug than one long program.
How do I forward everything to a central Vector over TLS?
Run one Vector as an aggregator and point agents at it with the native vector sink and source, which carry events with all fields intact. On the aggregator:
sources:
from_agents:
type: vector
address: 0.0.0.0:6000
tls:
enabled: true
crt_file: /etc/vector/tls/agg.pem
key_file: /etc/vector/tls/agg.key
ca_file: /etc/vector/tls/ca.pem
verify_certificate: trueOn each agent, add a sink with a disk buffer so events survive restarts and network outages:
sinks:
to_central:
type: vector
inputs: [no_debug]
address: logs.example.net:6000
tls:
enabled: true
ca_file: /etc/vector/tls/ca.pem
crt_file: /etc/vector/tls/agent.pem
key_file: /etc/vector/tls/agent.key
buffer:
type: disk
max_size: 268435488
when_full: blockWith verify_certificate on the aggregator, only agents holding a certificate from your CA can connect. The private CA guide shows how to issue the files. Open port 6000 only to the agent addresses, for example sudo ufw allow from 203.0.113.10 to any port 6000 proto tcp, and see the firewall tutorial for nftables rules.
How do I keep the API and exporter ports private?
Bind every listener you do not deliberately share to 127.0.0.1, as in the examples: the API on 8686 and the Prometheus exporter on 9598. Check what Vector exposes after each change:
sudo ss -tlnp | grep vectorOnly the aggregator port should show a public address. If a remote Prometheus must scrape the exporter, either allow its single IP in the firewall or publish the endpoint through a reverse proxy with HTTPS and basic auth, using the pattern from the Caddy tutorial. Never expose the API port: it reveals the whole pipeline layout. For a quick look from your laptop, an SSH tunnel such as ssh -N -L 8686:127.0.0.1:8686 deploy@198.51.100.24 lets you run vector top --url http://127.0.0.1:8686/graphql locally.
What are the usual problems and their fixes?
- Permission denied on the journal or a file: the
vectoruser lacks thesystemd-journaloradmgroup. Add it and restart the service. - Service fails to start after an edit: run
vector validate; the error names the component and line. - Events stop at the aggregator: test reachability with
nc -vz logs.example.net 6000and check the certificate names match the address used by agents. - Disk buffer grows: the sink is blocked downstream. Look at
vector topfor the component with events in but none out. - Too much volume: filter early, drop unneeded fields in
remap, or add asampletransform for chatty debug sources.
Rotate or prune the file sink output with logrotate and a copytruncate rule, or let the date in the file name and a small cleanup timer handle it.
Plans that fit this guide
Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.
Questions about Vector log and metrics pipeline
Is Vector a replacement for Promtail or Filebeat?
It covers the same jobs, reading files and the journal and shipping them on, and adds metrics handling and VRL transforms. Pick one shipper per server to keep things simple.
Does Vector store data itself?
Only in buffers and its checkpoint data in /var/lib/vector. Long term storage belongs in a sink such as Loki, Graylog, files or Prometheus.
Can Vector collect Docker container logs?
Yes, with the docker_logs source. Add the vector user to the docker group, which grants wide access, so do it only on servers you control.
How much memory does an agent need?
A basic agent with a few sources uses a modest amount of RAM. Disk buffers move pressure from memory to disk, which suits small plans.
Does it work on Rocky Linux or AlmaLinux?
The same setup script adds an RPM repository for dnf, and the configuration in this guide works unchanged. This page lists Ubuntu and Debian steps only.
How do I see where events are lost?
Run vector top and compare events in and out per component, then check journalctl -u vector for errors from the failing component.
More in Monitoring and logs
- Netdata real-time monitoring
- Uptime Kuma status page
- Prometheus and node_exporter
- Grafana dashboards
- Zabbix monitoring
- Nagios Core
- Beszel lightweight monitoring
- Loki and Alloy for central logs
- Cacti graphs with SNMP
- Monit for self-healing services
- btop, htop and other live monitors
- Central logs with rsyslog
- Rotate logs with logrotate
- Read logs with journalctl
- Graylog log management
- Observium network monitoring