- A log drain sends the platform logs of your Supabase project, such as Postgres, Auth, Storage, and Edge Functions logs.
- The LogBrew JavaScript SDK sends the logs and errors that your own Edge Function code captures.
server
key for each use. The key kinds are in
Project key kinds.
Send platform logs with a log drain
Supabase log drains are available on the Supabase Pro, Team, and Enterprise plans. Supabase charges for each drain and for the events it sends. Read the Supabase pricing before you add a drain.1
Open the log drain settings
In the Supabase dashboard, open your project. Go to Project Settings
and then Log Drains.
2
Add an OpenTelemetry destination
Add a destination of the type OpenTelemetry (OTLP). Set these values:
You can use the header
Authorization with the value
Bearer lbw_ingest_... instead of x-logbrew-key.3
Save the destination
Save the destination. Supabase starts to send logs to LogBrew.Checkpoint: new Supabase logs show in the logs of your LogBrew
project. To read them from the CLI, follow
Read your test event back.
service.name resource attribute
sets the service of each log. The other resource attributes stay in the log
metadata. LogBrew removes credentials from URLs and from attributes such as
authorization before it stores the log. The full mapping is in
Send OpenTelemetry data.
If no logs arrive, check the endpoint, the protocol, and the header. The
ingest key must belong to the LogBrew project that you read.
Capture logs and errors in Edge Functions
Supabase Edge Functions run on Deno. Use@logbrew/node from npm. This
setup works with Deno 2.9, @logbrew/node 0.1.20, and @logbrew/sdk 0.1.35.
1
Save the ingest key as a function secret
Use the Supabase CLI. Replace the placeholder with your key:
2
Create the client and flush before you return
Create the client once, outside the request handler. Capture events in
the handler. Call
flush() before you return the response, because the
function can stop after it returns.captureRuntimeContext: false and the runtime context make LogBrew
show Deno as the runtime. Without them, the SDK reports the Node.js
version that Deno emulates.If delivery fails, flush() throws an SdkError, for example with the
code network_failure. The example writes only the error code to the
function log, and the function still returns its response.3
Deploy and call the function
Deploy the function with
supabase functions deploy checkout. Call it
once.Checkpoint: the checkout request log shows in your LogBrew project.