# Move your logs to Tailcove from Datadog, Better Stack, Loki or Papertrail

Most teams stay on a log tool they've outgrown because moving feels like a project: every server, every app, every
alert. It doesn't have to be. Tailcove reads the formats your shippers already send, so you change a URL and a token
and leave the rest of the config alone. You run both tools side by side until you trust the new one, and nobody loses
a line on the way over.

This guide takes one source from start to finish. Do it for your noisiest app first, then repeat it for the rest.

![Your shipper keeps sending to your current tool and also sends the same lines to ingest.tailcove.dev](https://tailcove.dev/images/docs/moving/side-by-side.svg "Add Tailcove as a second destination, compare for a week or two, then remove the old one.")

## 1. Create a source and copy its token

In Tailcove, choose **New source**, name it after the app and environment (`shop-production`), and pick the platform
closest to what sends the logs. The last step shows the source's **ingest token**. Copy it now: it's shown once.

![The ingest token on a new source's page](https://tailcove.dev/images/docs/getting-started/ingest-token.png "The token is what your shipper sends instead of the old tool's API key. Tailcove stores only a hash of it.")

Every snippet below uses `YOUR_INGEST_TOKEN` where it goes.

> [!TIP]
> One source per app and environment keeps searches and alerts simple. You can rename a source later, but not change
> its platform.

## 2. Send to both

Keep your current destination and add Tailcove as a second one. Pick the tab for what you run today.

```yaml@Datadog_Agent
# datadog.yaml: Datadog keeps getting every log, Tailcove gets a copy.
logs_enabled: true
logs_config:
  force_use_http: true
  additional_endpoints:
    - api_key: "YOUR_INGEST_TOKEN"
      Host: "ingest.tailcove.dev"
      Port: 443
      is_reliable: true
```

```toml@Vector
# Add a second sink next to the one you have. Vector sends to both.
[sinks.tailcove]
type = "datadog_logs"
inputs = ["app_logs"]
endpoint = "https://ingest.tailcove.dev"
default_api_key = "YOUR_INGEST_TOKEN"
compression = "gzip"
```

```ini@Fluent_Bit
# A second [OUTPUT] with the same Match as your current one.
[OUTPUT]
    Name        datadog
    Match       *
    Host        ingest.tailcove.dev
    TLS         on
    compress    gzip
    apikey      YOUR_INGEST_TOKEN
```

```yaml@Promtail
# Promtail pushes to every client in the list.
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
```

```js@Better_Stack_(Node.js)
// A second logger next to the one you have; remove the first one later.
import { Logtail } from "@logtail/node";

const tailcove = new Logtail("YOUR_INGEST_TOKEN", {
  endpoint: "https://ingest.tailcove.dev/api/v1/betterstack",
});
```

```bash@Papertrail_(rsyslog)
# /etc/rsyslog.d/60-tailcove.conf: keep your Papertrail line, add this.
sudo tee /etc/rsyslog.d/60-tailcove.conf >/dev/null <<'CONF'
template(name="TailcoveFormat" type="string"
  string="<%PRI%>1 %TIMESTAMP:::date-rfc3339% %HOSTNAME% %APP-NAME% %PROCID% - [tailcove@41058 token=\"YOUR_INGEST_TOKEN\"] %msg%\n")
action(type="omfwd" target="ingest.tailcove.dev" port="6514" protocol="tcp"
       StreamDriver="gtls" StreamDriverMode="1" StreamDriverAuthMode="x509/name"
       StreamDriverPermittedPeers="ingest.tailcove.dev" template="TailcoveFormat")
CONF
sudo systemctl restart rsyslog
```

Restart or reload the shipper. The Datadog Agent's file and restart command depend on the system:

```bash@Linux
# Config: /etc/datadog-agent/datadog.yaml
sudo systemctl restart datadog-agent
```

```bash@macOS
# Config: ~/.datadog-agent/datadog.yaml
launchctl stop com.datadoghq.agent
launchctl start com.datadoghq.agent
```

```powershell@Windows
# Config: C:\ProgramData\Datadog\datadog.yaml. Run PowerShell as Administrator.
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" restart-service
```

Vector, Fluent Bit and rsyslog above assume a Linux server with systemd (`sudo systemctl restart vector`,
`fluent-bit` or `rsyslog`). Grafana Alloy users: add a `loki.write` block for Tailcove and put its receiver next to
your current one in `forward_to` ([Loki page](https://tailcove.dev/docs/moving/loki)). Python and PHP Better Stack clients take the same
endpoint ([Better Stack page](https://tailcove.dev/docs/moving/better-stack)).

> [!NOTE]
> The Datadog Agent can compress logs with zstd, which Tailcove doesn't read. If nothing arrives and the Agent's log
> says `422`, add `compression_kind: gzip` under `logs_config`.

## 3. Check the lines arrived

Open the source's **Live tail**. Lines show up within a few seconds of your app logging them. Then open **Logs** and
search for something you know happened, the way you would in the old tool.

![Live tail as Datadog-format lines arrive at the Datadog-compatible endpoint; opening the error shows service, ddsource, order_id and the tags as fields](https://tailcove.dev/images/guides/move-your-logs-to-tailcove/datadog-lines.mp4 "Lines sent the way the Datadog Agent sends them. Open one and its service, ddsource, attributes and tags are fields you can search.")

Your fields come over with the names they had:

| From          | What you'll find in Tailcove                                                        |
| ------------- | ----------------------------------------------------------------------------------- |
| Datadog       | `service`, `ddsource`, each tag (`env`, `version`, …) and every attribute as fields |
| Better Stack  | everything next to `dt`, `level` and `message`, under the same names                |
| Loki          | each label and structured metadata value as a field (`job`, `namespace`, `pod`, …)  |
| Papertrail    | `app_name`, `hostname` and `facility`                                               |

## 4. Rewrite the searches you rely on

Tailcove's [query language](https://tailcove.dev/docs/query-language) is close to what you know. The differences that trip people up:

| You wrote                              | In Tailcove                         |
| -------------------------------------- | ----------------------------------- |
| `status:error` (Datadog)               | `level:error`                       |
| `@duration:>500` (Datadog)             | `duration>500`                      |
| `@duration:[100 TO 500]` (Datadog)     | `duration>=100 duration<=500`       |
| `@http.status_code:>=500` (Datadog)    | log it as `status_code`, then `status_code>=500` |
| `{job="api"} \|= "timeout"` (Loki)     | `job:api timeout`                   |
| `{app="shop"} != "health"` (Loki)      | `app:shop -health`                  |
| `program:sshd` (Papertrail)            | `app_name:sshd`                     |

Fields are top-level here, so a nested attribute needs a top-level name to be searchable. Free text, quoted phrases,
`OR`, `-` and parentheses work as you'd expect. Save the searches you use every day with **Saved** on the Logs page.

## 5. Bring your alerts

**From Datadog:** open the source's **Alerts** tab and choose **Import from Datadog**. Paste a monitor's JSON (Export
in the monitor's menu) or the whole answer of `GET /api/v1/monitor`. You see what each monitor becomes before
anything is saved, and why the others can't come over as they are.

![Pasting four exported Datadog monitors, the preview showing two that become alerts and two that say why not, then Import 2 alerts](https://tailcove.dev/images/guides/move-your-logs-to-tailcove/import-monitors.mp4 "Log monitors that count lines come over; a per-host .by() monitor and a metric monitor say why they don't.")

**From anywhere else:** the new source's Overview offers [recommended alerts](https://tailcove.dev/docs/alerts#recommended-alerts): an error
spike, any critical line and "stopped sending logs", plus failed jobs for Laravel. Turn those on, then recreate the
few alerts of your own that have actually woken someone up. It's usually fewer than you'd guess.

Imported and recommended alerts email your team. Add Slack, PagerDuty or a webhook on each one before you rely on it.

## 6. Turn the old destination off

Give it a week or two. When an incident is easier to follow in Tailcove than in the old tool, make Tailcove the only
destination.

```yaml@Datadog_Agent
# datadog.yaml: logs now go to Tailcove only.
logs_enabled: true
logs_config:
  force_use_http: true
  logs_dd_url: "ingest.tailcove.dev:443"
  compression_kind: gzip
# The logs API key is your Tailcove ingest token: set DD_LOGS_CONFIG_API_KEY,
# or api_key if this Agent sends nothing else to Datadog.
```

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

```bash@Papertrail_(rsyslog)
# Remove the Papertrail line, keep 60-tailcove.conf.
sudo sed -i '/papertrailapp\.com/d' /etc/rsyslog.conf /etc/rsyslog.d/*.conf
sudo systemctl restart rsyslog
```

With Vector, Fluent Bit or a Better Stack client, delete the old sink, output or logger.

## If nothing arrives

| What you see                       | What it means and what to do                                                              |
| ---------------------------------- | ----------------------------------------------------------------------------------------- |
| `401` in the shipper's log         | The token is wrong or from another source. Copy it again from the source's page.          |
| `422` mentioning zstd              | Set `compression_kind: gzip` (Datadog Agent) or `compression = "gzip"` (Vector).          |
| `422` about too many records       | One request carried more than 10,000 lines. Lower the shipper's batch size.               |
| `413`                              | A request was over 5 MB. Lower the batch size.                                            |
| `429`                              | You're over your plan's rate. The shipper retries; check your usage on the Billing page.        |
| Lines arrive, but fields are missing | The shipper sends them nested. Search the parent field, or flatten them in the shipper. |

## What stays behind

Lines you already sent stay in the old tool: keep it until its retention runs out, or export what you need to keep.
Dashboards and saved views don't move by themselves; rebuild the ones you open every week in
[Dashboards](https://tailcove.dev/docs/dashboards). Metrics and traces from the same vendor keep going where they went until you move them
too ([metrics](https://tailcove.dev/docs/metrics/overview), [traces](https://tailcove.dev/docs/opentelemetry/traces)).

Every page for a specific tool, with more options, is under [Moving to Tailcove](https://tailcove.dev/docs/moving/overview).
