Skip to content

Vector Log Shipping to AppSignal

This guide documents how to set up Vector to ship application and database logs to AppSignal.

Vector is a high-performance observability data pipeline that collects logs from multiple sources and ships them to AppSignal for centralized monitoring.

┌─────────────────────────────────────────────────────────────┐
│ chi-vultr-heatwave-util1 (App Server) │
├─────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ Sidekiq Workers │────▶│ │ │
│ └─────────────────┘ │ production.log │───┐ │
│ ┌─────────────────┐ │ │ │ │
│ │ Rails App │────▶│ │ ▼ │
│ └─────────────────┘ └─────────────────┘ ┌────────┐ │
│ │ Vector │────┼──▶ AppSignal
│ └────────┘ │ (sidekiq/rails)
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ chi-vultr-heatwave-db4 (Database Server) │
├─────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────┐ ┌─────────────────┐ ┌────────┐ │
│ │ PostgreSQL 16 │────▶│ postgresql.log │─▶│ Vector │───┼──▶ AppSignal
│ └─────────────────┘ └─────────────────┘ └────────┘ │ (postgresql)
│ │
└─────────────────────────────────────────────────────────────┘

Configuration files are stored per-server in the codebase:

config/deploy/templates/
├── chi-vultr-heatwave-util1/ # Application server
│ ├── vector.yaml # Vector configuration
│ ├── vector.env.example # Environment template
│ └── vector.service # Systemd service (reference)
└── chi-vultr-heatwave-db4/ # Database server
├── vector.yaml # Vector configuration
├── vector.env.example # Environment template
└── vector.service # Systemd service (reference)
ServerLog GroupDescription
util1sidekiqSidekiq worker logs (detected from production.log)
util1railsRails application logs
db4postgresqlPostgreSQL errors, deadlocks, and warnings

  1. AppSignal account with Logging enabled
  2. AppSignal Push API Key from AppSignal Settings → Push & Deploy
  3. SSH access to both servers

In AppSignal:

  1. Go to Logging → Sources → Add log source
  2. Create these sources:
NameTypeFormat
sidekiqvectorlogfmt or json
railsvectorlogfmt or json
postgresqlvectorlogfmt or json

Application Server (chi-vultr-heatwave-util1)

Section titled “Application Server (chi-vultr-heatwave-util1)”
Terminal window
ssh deploy@chi-vultr-heatwave-util1
# Add Vector repository
curl -1sLf 'https://repositories.timber.io/public/vector/cfg/setup/bash.deb.sh' | sudo bash
# Install Vector
sudo apt install vector
Terminal window
# Copy from local machine or after deployment
sudo cp /var/www/heatwave/current/config/deploy/templates/chi-vultr-heatwave-util1/vector.yaml /etc/vector/vector.yaml
Terminal window
sudo tee /etc/vector/vector.env << 'EOF'
APPSIGNAL_PUSH_API_KEY=your-push-api-key-here
HOSTNAME=chi-vultr-heatwave-util1
EOF
sudo chmod 600 /etc/vector/vector.env

The APT package includes a default service, but we need to add environment file support:

Terminal window
sudo mkdir -p /etc/systemd/system/vector.service.d
sudo tee /etc/systemd/system/vector.service.d/override.conf << 'EOF'
[Service]
EnvironmentFile=/etc/vector/vector.env
EOF

Vector needs write access to its data directory for checkpointing:

Terminal window
sudo chown -R vector:vector /var/lib/vector
sudo chmod 755 /var/lib/vector
Terminal window
sudo systemctl daemon-reload
sudo systemctl enable vector
sudo systemctl start vector
sudo systemctl status vector

Terminal window
ssh root@chi-vultr-heatwave-db4
# Add Vector repository
curl -1sLf 'https://repositories.timber.io/public/vector/cfg/setup/bash.deb.sh' | sudo bash
# Install Vector
sudo apt install vector
Terminal window
# Copy the database-specific config
sudo cp /path/to/vector.yaml /etc/vector/vector.yaml

Or copy from local:

Terminal window
# From your local machine:
scp config/deploy/templates/chi-vultr-heatwave-db4/vector.yaml root@chi-vultr-heatwave-db4:/etc/vector/vector.yaml
Terminal window
sudo tee /etc/vector/vector.env << 'EOF'
APPSIGNAL_PUSH_API_KEY=your-push-api-key-here
EOF
sudo chmod 600 /etc/vector/vector.env
Terminal window
sudo mkdir -p /etc/systemd/system/vector.service.d
sudo tee /etc/systemd/system/vector.service.d/override.conf << 'EOF'
[Service]
EnvironmentFile=/etc/vector/vector.env
EOF
Terminal window
sudo chown -R vector:vector /var/lib/vector
sudo chmod 755 /var/lib/vector
Terminal window
sudo systemctl daemon-reload
sudo systemctl enable vector
sudo systemctl start vector
sudo systemctl status vector

Terminal window
sudo systemctl status vector
Terminal window
sudo journalctl -u vector -f
Terminal window
sudo journalctl -u vector --since "5 minutes ago" | grep -i error

Before starting the service, you can validate manually:

Terminal window
sudo bash -c 'set -a && source /etc/vector/vector.env && set +a && /usr/bin/vector'

Press Ctrl+C to stop after confirming it starts successfully.

  1. Go to Logging → All logs
  2. Filter by group: sidekiq, rails, or postgresql
  3. Filter by hostname to see logs from specific servers
  4. Logs should appear within 1-2 minutes

The database Vector config filters logs to only ship:

CategoryExamples
Errors/WarningsAll ERROR, WARNING, FATAL levels
Deadlocksdeadlock detected, detected deadlock while waiting
Lock Issueslock timeout, still waiting for, canceling statement due to lock
Timeoutscanceling statement due to statement timeout
Connectionsterminating connection, could not connect, connection reset
Constraintsviolates, duplicate key
Resourcesout of memory, temporary file
Replicationreplication slot, WAL segment

This reduces noise from routine LOG-level messages while capturing all debugging-relevant events.


Check configuration syntax:

Terminal window
sudo bash -c 'set -a && source /etc/vector/vector.env && set +a && vector validate /etc/vector/vector.yaml'
Terminal window
# Fix /var/lib/vector permissions
sudo chown -R vector:vector /var/lib/vector
sudo chmod 755 /var/lib/vector
sudo systemctl restart vector

The EnvironmentFile directive does NOT support export:

Terminal window
# WRONG - will be ignored:
export APPSIGNAL_PUSH_API_KEY=xxx
# CORRECT:
APPSIGNAL_PUSH_API_KEY=xxx
  1. Verify API key is correct in /etc/vector/vector.env
  2. Test manually with curl:
Terminal window
curl -v -X POST "https://appsignal-endpoint.net/logs/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"message":"test","level":"info"}'

Should return 200 OK.

The Vector config includes batching limits to prevent this:

batch:
max_bytes: 400000 # Stay under AppSignal's 500KB limit
timeout_secs: 5

If you see this error, clear old checkpoint data:

Terminal window
sudo rm -rf /var/lib/vector/*
sudo systemctl restart vector
  1. Check file permissions: Vector needs read access to log files
  2. Check network: Ensure outbound HTTPS to appsignal-endpoint.net
  3. Check log group: Verify AppSignal source names match .group in config

Terminal window
sudo apt update
sudo apt upgrade vector
sudo systemctl restart vector
Terminal window
vector --version

If you need to re-ship logs:

Terminal window
sudo systemctl stop vector
sudo rm -rf /var/lib/vector/*
sudo systemctl start vector

Warning: This will re-process logs from the current file position.