Skip to content

Vector for edge log shipping — collect, transform, fan out

Deploy Vector as an edge log/metric shipper — sources, remap-language transforms, multi-sink fan-out, and the disk-buffered durability we wire in.

Vector is the log/metric/trace shipper we install on every edge node we run — from CDN POPs to bare-metal cache servers to application VMs. It replaces Filebeat, rsyslog, Promtail, and the scattering of “just curl it to the API” bash scripts that grow on a fleet. This article is the operational install: where Vector earns its keep, how the source/transform/sink model maps to a real pipeline, and what we wire in before declaring it production.

How to verify

Check whether the host has any existing shipper running and what is currently filling its log directories.

ss -lntp | grep -E ':(514|5044|2020|8686)\b'
systemctl status filebeat rsyslog promtail fluent-bit vector 2>&1 | grep -E 'Loaded|Active'
journalctl -u systemd-journald --output=cat -n 5
ls -lh /var/log/nginx /var/log/syslog 2>/dev/null

If multiple shippers are running, you have an N-way log fan-in problem before you can call any pipeline reliable.

What’s happening

Vector’s mental model is three node types in a graph: sources produce events (files, syslog, journal, kafka, http_server), transforms filter/enrich/reshape (remap with VRL — Vector’s small DSL — or aggregate, dedupe, sample), and sinks write events out (loki, elasticsearch, s3, http, kafka, datadog, prometheus_exporter). Events flow source -> [transforms] -> sink, with an optional in-memory or on-disk buffer at the sink boundary.

The big operational wins over the alternatives: a single binary in Rust (no JVM), built-in disk buffering so a downstream outage does not lose data, a configuration language that catches errors at startup rather than runtime, and the VRL transform language that handles “parse this regex, conditionally drop, rename a field” without dropping to Lua or a shell.

What you give up: Vector is configuration-heavy and the docs are dense. The “happy path” is straightforward, but the moment you need a custom transform you are reading VRL examples and the type system.

The procedure

  1. Install Vector. The deb package is the canonical install on Ubuntu.

    curl -1sLf 'https://repositories.timber.io/public/vector/cfg/setup/bash.deb.sh' | bash
    apt update && apt install -y vector
    vector --version
  2. Lay down a minimal config that tails nginx access/error logs, parses them with VRL, and ships to Loki and S3.

    # /etc/vector/vector.toml
    [sources.nginx_access]
    type = "file"
    include = ["/var/log/nginx/access.log"]
    read_from = "end"
    
    [sources.nginx_error]
    type = "file"
    include = ["/var/log/nginx/error.log"]
    read_from = "end"
    
    [transforms.parse_access]
    type = "remap"
    inputs = ["nginx_access"]
    source = '''
    parsed, err = parse_nginx_log(.message, "combined")
    if err == null { . = merge!(., parsed) }
    .host = get_hostname!()
    '''
    
    [sinks.loki]
    type = "loki"
    inputs = ["parse_access", "nginx_error"]
    endpoint = "http://loki.internal:3100"
    labels = { host = "{{ host }}", service = "nginx" }
    encoding.codec = "json"
    
    [sinks.s3_archive]
    type = "aws_s3"
    inputs = ["parse_access"]
    bucket = "logs-archive"
    key_prefix = "nginx/%Y/%m/%d/"
    region = "ca-central-1"
    compression = "gzip"
    buffer.type = "disk"
    buffer.max_size = 1073741824    # 1 GiB
    buffer.when_full = "block"
  3. Validate the config before reloading. Vector’s validate subcommand catches type mismatches and missing dependencies.

    vector validate /etc/vector/vector.toml
    systemctl reload vector
    journalctl -u vector --since '1 min ago' | tail -20
  4. Wire the disk buffer. Without a disk buffer at the sink, a downstream outage will block the source — which on a file source means the log files grow because Vector cannot read forward.

    [sinks.loki]
    buffer.type = "disk"
    buffer.max_size = 268435456    # 256 MiB on-disk
    buffer.when_full = "drop_newest"   # or "block" for full back-pressure
  5. Expose Vector’s own metrics. Vector ships with a Prometheus exporter; scrape it like any other workload.

    [sources.internal_metrics]
    type = "internal_metrics"
    
    [sinks.prometheus]
    type = "prometheus_exporter"
    inputs = ["internal_metrics"]
    address = "0.0.0.0:9598"

Common pitfalls

  • Running Vector with read_from = "beginning" on a freshly-deployed host with a year of log history; you will saturate the downstream sink before you ship a single new event.
  • Forgetting to set buffer.when_full — the default drops the newest event, which silently breaks ordering and produces gaps your dashboards cannot explain.
  • Parsing logs in VRL with parse_regex when parse_nginx_log / parse_json exist — the built-ins are faster and more forgiving.
  • Putting credentials in vector.toml instead of ${VAR} env interpolation — Vector reads env vars at startup; rotate keys via the unit’s EnvironmentFile.
  • Using Vector as a metric scraper for Prometheus exporters — it works, but Vector is not a TSDB, it is a shipper. Send the metrics to a TSDB sink.

In the engagements we run, Vector replaces the patchwork of tail | curl scripts and inconsistently-configured Filebeats that accumulate on a fleet. The pipeline becomes part of the platform — versioned, reviewed, and observable. That is the kind of plumbing Stack Harbor owns in managed operations: if logs are not arriving at the SIEM, that is on us, not the application team.