
Vector is an open-source, high-performance observability data pipeline built with Rust. It collects, transforms, and routes logs, metrics, and traces from multiple sources to various destinations with minimal resource overhead. Vector's unified architecture eliminates the need for separate agents for different data types, while its built-in buffering and retry mechanisms ensure reliable delivery even during downstream service outages.
This article explains how to deploy Vector on a Linux server using Docker Compose with Traefik providing automatic HTTPS for the GraphQL API endpoint. It covers directory setup, configuration management, and demonstrates a practical use case by ingesting sample logs and forwarding them to multiple destinations.
Before you begin, you need to:
vector.example.com).Vector requires a configuration file defining data sources, transforms, and destinations. The setup includes persistent storage for buffer data to prevent loss during restarts and an optional GraphQL API for querying pipeline health and metrics.
Create the project directory with subdirectories for configuration and data persistence.
config: Stores the Vector configuration file (vector.yaml) that defines sources, transforms, and sinks.data: Persists buffer data to prevent log loss during container restarts or crashes.Navigate to the project directory.
Create an environment file to store configuration variables.
Add the following content:
Replace:
vector.example.com with your registered domain name.admin@example.com with your email address for Let's Encrypt certificate notifications.Save and close the file.
Create the Vector configuration file that defines the data pipeline.
Add the following configuration:
Save and close the file.
This configuration establishes a complete observability pipeline:
/health) and an interactive GraphQL Playground (/playground).demo_logs: Generates synthetic syslog-formatted events for testing (1 event per second). Remove this source and its reference in the parse_logs transform inputs for production deployments to avoid unnecessary log volume.http_input: Accepts JSON-formatted logs via HTTP POST on port 8080.parse_logs: Adds processed_at timestamp and pipeline identifier to all events.console_output: Prints logs to stdout, visible via docker compose logs vector.file_output: Writes logs to date-stamped files in /var/lib/vector, which maps to the ./data/ directory on the host due to the bind mount.http_output: Forwards logs to an external HTTP endpoint (configured to use httpbin.org for demonstration).The deployment stack consists of Traefik for reverse proxy and certificate management, plus the Vector container with mounted configuration and data directories. This configuration uses the official Vector Docker image.
Create the Docker Compose manifest.
Add the following configuration:
Save and close the file.
In the above manifest:
0.44.0-alpine) for reproducibility; check the Vector releases for the latest stable version. The Alpine variant provides a minimal footprint.80 and 443 on the host for external traffic handling.8080 (HTTP log ingestion) and 8686 (GraphQL API/Playground) accessible to Traefik for internal routing without binding them to the host../letsencrypt bind mount stores TLS certificates persistently across container restarts./var/run/docker.sock) grants Traefik the ability to discover services and update routes dynamically.vector.yaml bind mount (read-only) injects the pipeline configuration into the container.data bind mount preserves buffered logs and state across restarts.vector-api: Routes requests matching /playground, /graphql, or /health to the GraphQL API on port 8686.vector-ingest: Routes requests matching /ingest to the HTTP log ingestion endpoint on port 8080. The strip-ingest middleware removes the /ingest prefix before forwarding, so Vector receives requests at its root path. Both routers use HTTPS with automatic Let's Encrypt certificates.Launch the containers.
Verify both services are operational.
The output displays two running containers with Traefik listening on ports 80 and 443.
Check the service logs to confirm Vector loaded the configuration successfully.
Output:
For more information on managing a Docker Compose stack, see the How To Use Docker Compose article.
Vector exposes a GraphQL API for querying pipeline state and metrics programmatically. It also includes a GraphQL Playground UI for interactive exploration.
Open your web browser and navigate to the GraphQL Playground at https://vector.example.com/playground, replacing vector.example.com with your configured domain.
Use the Playground to run GraphQL queries against Vector's API and inspect components and metrics. To check instance health separately, send a request to the /health endpoint.
Vector is an observability data pipeline. It collects, transforms, and routes logs, metrics, and traces to downstream destinations. If you need dashboards or visualizations, those are typically provided by destination systems (such as Grafana, Datadog, or Elasticsearch/Kibana). This article focuses on Vector's core pipeline functionality.
Vector's demo source generates synthetic logs automatically. The following steps demonstrate ingesting custom logs via HTTP and verifying delivery to multiple destinations.
View the real-time log output in the container logs. The demo source generates one event per second.
Output:
Press Ctrl+C to stop following the logs.
Send a custom log entry to the HTTP input endpoint through Traefik. Replace vector.example.com with your configured domain:
On success, Vector returns an HTTP 200 response with an empty body. If curl displays no output, the log was accepted successfully. Traefik strips the /ingest prefix and forwards the request to Vector's HTTP server on port 8080.
Verify the log was processed by searching the file output, which is more reliable for targeted verification than the console output that generates continuous output from the demo source:
Output:
Check the file sink output to confirm logs are written to disk.
Output:
Examine the file contents.
Output:
Verify the HTTP source received your custom log by filtering for http_server events.
Output:
This confirms your custom log was received via HTTP and processed through the pipeline. The http_output sink forwards these logs to httpbin.org silently (no success messages are logged by default).
You have successfully deployed Vector on your server using Docker Compose with Traefik for automatic HTTPS on the API endpoint. The setup provides a high-performance observability data pipeline with real-time log ingestion, transformation, and multi-destination routing. Vector's unified architecture handles logs, metrics, and traces with minimal resource consumption, while its built-in buffering ensures reliable delivery during downstream outages. The persistent data directory preserves in-flight data across restarts, and the GraphQL API provides programmatic access to pipeline health and metrics. For advanced use cases including metric collection, distributed tracing, and enterprise integrations, visit the official Vector documentation.
0 Comments
Be the first to comment and share your perspective with the community.