# Better Stack Supabase logging

Collect logs from your [Supabase](https://supabase.com/) projects by configuring a custom log drain endpoint.

[info]
Supabase plan **Pro**, **Team**, or **Enterprise** is required.

For a detailed breakdown of how additional charges are calculated in Supabase, refer to their [Manage Log Drain usage](https://supabase.com/docs/guides/platform/manage-your-usage/log-drains) guide.
[/info]

## 1. Create a new source

[Create a new HTTP source](https://telemetry.betterstack.com/team/0/sources/new?platform=http ";_blank") in Better Stack.

Copy the **Ingesting host** and **Source token** from the source details. You will need these in the next step.

## 2. Configure log drain in Supabase

In your Supabase project dashboard, go to **Project Settings** → **Log drains**, and create a new **Custom endpoint**.

![Custom endpoint log drain](https://imagedelivery.net/xZXo0QFi-1_4Zimer-T0XQ/f6ded86c-903c-49c8-1b7b-ae8d6e222c00/public =2574x1276)

Set the **Endpoint URL** to:

```
[label Endpoint URL for your destination]
https://$INGESTING_HOST?source_token=$SOURCE_TOKEN
```

After you click **Save destination**, you should see your Supabase logs in [Better Stack → Live tail](https://telemetry.betterstack.com/team/0/tail ";_blank").

## 3. Enhance log display and data

To make the integration even better, you can apply some optional configurations in Better Stack:

### Normalize the data on ingest

Supabase logs includes a `timestamp` field. To align this with Better Stack's standard `dt` field, you can use a [VRL transformation](https://betterstack.com/docs/logs/using-logtail/transforming-ingested-data/logs-vrl/).

You can also normalize the different log level fields `metadata.level` and `metadata.parsed.error_severity`.

Go to [Sources](https://telemetry.betterstack.com/team/0/sources ";_blank") → Supabase source → **Configure** → **Transformations** tab, and add the following VRL:

```vrl
[label VRL transformation]
.dt = del(.timestamp)
if (.metadata.level != null || .metadata.parsed.error_severity != null) {
    .level = upcase!(.metadata.level || .metadata.parsed.error_severity)
}
```

### Customize the Live tail message format

To see the most relevant information from your Supabase logs directly in the Live tail, you can [customize the default message format](https://betterstack.com/docs/logs/using-logtail/formatting-logs/).

Go to [Sources](https://telemetry.betterstack.com/team/0/sources ";_blank") → Supabase source → **Configure** → **Advanced settings** tab, and set the **Live tail message format** to:

```text
[label Live tail message format]
{metadata.host|metadata.context.host as host} {level} {event_message::text}
```

This will display the host, log level, and the main message content prominently in your Live tail.

## Need help?

Please let us know at hello@betterstack.com.  
We're happy to help! 🙏
