# Archive application logs to Amazon S3

Plan retention keeps logs searchable for up to 30 days. For audits and long-term analysis, scheduled exports copy every log line to a bucket you own, where you decide how long it lives.

This guide is about the log lines your apps and servers send to Tailcove. It doesn't archive email or a mailbox; for that, look at your mail provider's own export or journaling.

## 1. Prepare a bucket and credentials

Create a bucket, for example `acme-log-archive`, and an access key whose policy allows writing objects under the prefix you will use:

```json
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": ["s3:PutObject"],
            "Resource": "arn:aws:s3:::acme-log-archive/tailcove/*"
        }
    ]
}
```

Use a key dedicated to Tailcove so you can rotate or revoke it independently. Tailcove encrypts the credentials at rest and never shows the secret again.

## 2. Configure the export

Open the source in Tailcove and go to the **Export** tab:

| Field                             | Example             |
| --------------------------------- | ------------------- |
| Bucket                            | `acme-log-archive`  |
| Prefix                            | `tailcove`          |
| Region                            | `eu-west-1`         |
| Schedule                          | Hourly or daily     |
| Access key ID / Secret access key | The key from step 1 |

For S3-compatible storage such as MinIO, Cloudflare R2 or Backblaze B2, also set the **Endpoint**, and enable **Path-style addressing** if your provider needs it.

## 3. Know where files land

Each period is written as one gzipped NDJSON file:

```
{prefix}/{source id}/{yyyy}/{mm}/{dd}/{hh}.ndjson.gz
```

The source id is the one in the source's address, such as
`src_01jbx5q8k7m3n2p4r6s8t0v1w3`. Files written before 15 November 2026 sit
under the source's old numeric folder instead.

An hourly export writes one file per hour; a daily export writes one file per day under hour `00`. Exports run a few minutes after each period closes, so lines still in flight are included.

## 4. Verify it works

After the first period has closed, list the prefix:

```bash
aws s3 ls s3://acme-log-archive/tailcove/ --recursive
```

Download one file and read it:

```bash
aws s3 cp s3://acme-log-archive/tailcove/src_01jbx5q8k7m3n2p4r6s8t0v1w3/2026/11/20/14.ndjson.gz - | gunzip | head
```

The export tab also shows the last run's status and error, if any.

## 5. Set a lifecycle rule

Decide how long archives should live and let S3 enforce it, for example moving objects to a colder storage class after 30 days and expiring them after a year.

## Querying archives later

NDJSON is easy to load into most tools. With DuckDB, for example:

```sql
SELECT level, count(*)
FROM read_json_auto('14.ndjson.gz')
GROUP BY level;
```

## Next steps

- Pull recent logs programmatically with the [read API](https://tailcove.dev/guides/query-logs-with-the-api).
- Compare plans on the [pricing page](https://tailcove.dev/pricing).
