Vector log collection: ship server log files to Tailcove

Collect log files on a Linux server with Vector and ship them to Tailcove, with a working vector.toml, log levels and sensible batching.

Intermediate15 min to complete2 min read

Before you start

  • A Linux host with Vector installed
  • A Tailcove account with a source

Not every log comes from code you control. Nginx, cron jobs and legacy services write to files. Vector can tail those files and ship them to Tailcove's HTTP endpoint with no custom code, because the endpoint understands Vector's default event shape.

On this page7 sections

1. Create a source#

In Tailcove, open Sources, click New source and name it after the host or service, for example web-1-files. Copy the ingest token; it is shown once.

2. Configure a file source and the Tailcove sink#

Add this to /etc/vector/vector.toml:

[sources.app_logs]
type = "file"
include = ["/var/log/myapp/*.log"]

[sinks.tailcove]
type = "http"
inputs = ["app_logs"]
uri = "https://ingest.tailcove.dev/api/v1/logs"
method = "post"
auth.strategy = "bearer"
auth.token = "YOUR_INGEST_TOKEN"

[sinks.tailcove.encoding]
codec = "json"

With the JSON codec, Vector sends one JSON object per line. Tailcove maps Vector's message, timestamp and host fields automatically; other fields such as file are ignored.

3. Add a level#

File events have no level, so everything would arrive as the default. A small remap transform fixes that:

[transforms.add_level]
type = "remap"
inputs = ["app_logs"]
source = '''
.level = "info"
if contains!(.message, "ERROR") {
  .level = "error"
} else if contains!(.message, "WARN") {
  .level = "warning"
}
'''

[sinks.tailcove]
inputs = ["add_level"]

Remember to change the sink's inputs to the transform, as shown.

4. Tune batching#

The ingest endpoint accepts up to 1,000 lines per request, so let Vector batch generously:

[sinks.tailcove.batch]
max_events = 500
timeout_secs = 2

5. Keep the token out of the config file#

Vector can read environment variables in its config. Set TAILCOVE_TOKEN in the service environment and reference it:

auth.token = "${TAILCOVE_TOKEN}"

6. Verify it works#

Validate and restart Vector, then append a line to a watched file:

vector validate /etc/vector/vector.toml
sudo systemctl restart vector
echo "ERROR test line from vector" | sudo tee -a /var/log/myapp/test.log

The line shows up in the source's Live tail with level error.

Next steps#

Ready to try it on your own logs?

The Free plan includes a source, live tail, search and alerts. No credit card.