Docs / Monitoring & Logging / Setting Up Vector for Log Collection and Routing

Setting Up Vector for Log Collection and Routing

By Admin · Mar 13, 2026 · Updated Apr 25, 2026 · 5 views · 2 min read

Getting vector right from the start saves hours of debugging later. In this comprehensive guide, we'll cover everything from initial setup to production-ready configuration, including log-collection and routing considerations.

Prerequisites

  • Open ports: 3000 (Grafana), 9090 (Prometheus)
  • A registered domain name (for public-facing services)
  • Basic familiarity with the Linux command line
  • Docker installed (for containerized monitoring)

Stack Installation

Regular maintenance is essential for keeping your vector installation running smoothly. Schedule periodic reviews of log files, disk usage, and security updates to prevent issues before they occur.


# docker-compose.yml for monitoring stack
version: '3.8'
services:
  prometheus:
    image: prom/prometheus:latest
    volumes:
      - ./prometheus.yml:/etc/prometheus/prometheus.yml
      - prometheus_data:/prometheus
    ports:
      - "9090:9090"
    restart: unless-stopped

  grafana:
    image: grafana/grafana:latest
    volumes:
      - grafana_data:/var/lib/grafana
    ports:
      - "3000:3000"
    environment:
      - GF_SECURITY_ADMIN_PASSWORD=changeme
    restart: unless-stopped

volumes:
  prometheus_data:
  grafana_data:

This configuration provides a good balance between performance and resource usage. For high-traffic scenarios, you may need to increase the limits further.

Dashboard Configuration

After applying these changes, monitor the server's resource usage for at least 24 hours to ensure stability. Tools like htop, iostat, and vmstat can provide real-time insights into system performance.


# prometheus.yml
global:
  scrape_interval: 15s
  evaluation_interval: 15s

scrape_configs:
  - job_name: 'node'
    static_configs:
      - targets: ['localhost:9100']
  - job_name: 'vector'
    static_configs:
      - targets: ['localhost:9090']

The configuration above sets the recommended values for a VPS with 2-4GB of RAM. Adjust the memory-related settings proportionally if your server has different specifications.

Common Issues and Solutions

  • Permission denied errors: Ensure files and directories have the correct ownership. Use chown -R to fix ownership and chmod for permissions.
  • Service won't start: Check the logs with journalctl -xe -u vector. Common causes include port conflicts, missing configuration files, or insufficient permissions.
  • High memory usage: Review the configuration for memory-related settings. Reduce worker counts or buffer sizes if running on a low-RAM VPS.

Wrapping Up

Following this guide, your vector setup should be production-ready. Keep an eye on resource usage as your traffic grows and don't forget to test your backup and recovery procedures periodically.

Was this article helpful?