# Vector log collection: ship server log files to Tailcove

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.

## 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`:

```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:

```toml
[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:

```toml
[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:

```toml
auth.token = "${TAILCOVE_TOKEN}"
```

## 6. Verify it works

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

```bash
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

- Running containers? See [Forward Docker container logs with Fluent Bit](https://tailcove.dev/guides/fluent-bit-docker-logs).
- [Alert on error spikes](https://tailcove.dev/guides/alert-on-error-spikes) across these files.
- Field mapping details in the [Vector reference](https://tailcove.dev/docs/sending-logs/vector).
