# Moving from Grafana Loki

Tailcove speaks Loki's push API at `https://ingest.tailcove.dev/api/v1/loki/api/v1/push`, in JSON and in the snappy
protobuf that Promtail, Grafana Alloy and the Docker Loki driver send by default. Point the client at that URL with
your source's **ingest token** as a bearer token, or as the password of basic auth (the user name is ignored).

## Promtail

Promtail can push to more than one client, so you can send to both:

```yaml
clients:
  - url: http://loki:3100/loki/api/v1/push
  - url: https://ingest.tailcove.dev/api/v1/loki/api/v1/push
    bearer_token: YOUR_INGEST_TOKEN
```

## Grafana Alloy

```alloy
loki.write "tailcove" {
  endpoint {
    url          = "https://ingest.tailcove.dev/api/v1/loki/api/v1/push"
    bearer_token = "YOUR_INGEST_TOKEN"
  }
}
```

Add `loki.write.tailcove.receiver` to the `forward_to` list of your sources next to the Loki writer you have now.

## What arrives

Each entry is one line: its own time (to the millisecond), the line as the message, and the stream's labels and an
entry's structured metadata as fields of their own, so `{job="api"}` becomes the search `job:api`. They're also kept
together under `labels` and `metadata`. A label named `level`, `severity` or `detected_level`
sets the level, and one named `host`, `hostname`, `instance`, `node` or `pod` sets the host.

Loki makes you choose labels up front and keep them few. Tailcove indexes nothing in advance: any field in a line is
searchable. If your apps log JSON, consider shipping it as JSON with the [agent](https://tailcove.dev/docs/sending-logs/agent) or
[Vector](https://tailcove.dev/docs/sending-logs/vector) so each key becomes a field you can search on its own.

## Batch size

A push may carry up to 10,000 entries. Promtail and Alloy batch by bytes (1 MiB by default), which is fine for normal
lines; if you see `422` answers, lower `batchsize` (Promtail) or `batch_size` (Alloy).
