Skip to main content
RapidDev - Software Development Agency
supabase-tutorial

How to Enable and View Logs in Supabase

Supabase provides logs for API requests, PostgreSQL queries, Edge Functions, and Auth events through the Dashboard under the Logs section. Navigate to your project Dashboard and click Logs in the left sidebar to access API logs, Postgres logs, and Edge Function logs. You can filter by time range, status code, and path. For external monitoring, configure log drains to send logs to services like Datadog or Logflare.

What you'll learn

  • How to access API, Postgres, and Edge Function logs in the Supabase Dashboard
  • How to filter and search logs by time range, status code, and endpoint
  • How to read Edge Function console.log output in production
  • How to configure log drains for external monitoring services
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Beginner9 min read10-15 minSupabase (all plans, with limits on free tier), Dashboard access requiredMarch 2026RapidDev Engineering Team
TL;DR

Supabase provides logs for API requests, PostgreSQL queries, Edge Functions, and Auth events through the Dashboard under the Logs section. Navigate to your project Dashboard and click Logs in the left sidebar to access API logs, Postgres logs, and Edge Function logs. You can filter by time range, status code, and path. For external monitoring, configure log drains to send logs to services like Datadog or Logflare.

Accessing and Using Logs in the Supabase Dashboard

Supabase logs every API request, database query, Edge Function execution, and auth event. These logs are essential for debugging failed requests, monitoring performance, and auditing user activity. This tutorial shows you where to find each type of log in the Dashboard, how to filter them effectively, and how to set up external log drains for production monitoring.

Prerequisites

  • A Supabase project (free tier or above)
  • Access to the Supabase Dashboard
  • At least some API activity or Edge Function invocations to generate logs

Step-by-step guide

1

Access the Logs section in the Dashboard

Navigate to your Supabase project Dashboard and click on Logs in the left sidebar. You will see several log categories: API Gateway, Postgres, Edge Functions, Auth, Storage, and Realtime. Each category shows logs from its respective service. The API Gateway logs are the most commonly used — they show every REST API request including status codes, paths, and response times.

typescript
1# No code needed access via Dashboard
2# Dashboard > Logs (left sidebar)
3# Categories:
4# - API Gateway: REST API requests (PostgREST, Auth, Storage)
5# - Postgres: Database query logs
6# - Edge Functions: Function execution logs
7# - Auth: Authentication events
8# - Storage: File operations
9# - Realtime: WebSocket connections

Expected result: The Logs section is visible in the Dashboard with multiple log categories.

2

Filter API Gateway logs by status code and path

API Gateway logs show every HTTP request to your Supabase project. Use the built-in filters to narrow down results. Filter by status code to find errors (4xx, 5xx), by path to isolate specific endpoints, and by time range to focus on a particular incident. You can also use the search bar for custom queries. Each log entry shows the method, path, status code, response time, and request metadata.

typescript
1# Dashboard > Logs > API Gateway
2# Common filters:
3# Status: 400, 401, 403, 404, 500
4# Method: GET, POST, PATCH, DELETE
5# Path: /rest/v1/todos, /auth/v1/token
6# Time: Last 1 hour, Last 24 hours, Custom range
7
8# Example: Find all failed auth requests
9# Filter: path contains '/auth/' AND status >= 400
10
11# Example: Find slow API requests
12# Sort by response time, look for > 1000ms

Expected result: Filtered logs show only the requests matching your criteria, making it easy to identify issues.

3

View Edge Function logs with console.log output

Edge Function logs capture everything your function writes to console.log(), console.error(), and console.warn(), plus execution metadata like duration, status, and memory usage. Go to Dashboard > Logs > Edge Functions to view them. You can filter by function name to isolate a specific function's output. These logs are essential for debugging deployed Edge Functions since you cannot attach a debugger to production.

typescript
1// In your Edge Function, add logging:
2Deno.serve(async (req) => {
3 console.log('Request received:', req.method, req.url)
4
5 try {
6 const body = await req.json()
7 console.log('Request body:', JSON.stringify(body))
8
9 // Your logic here...
10 const result = { success: true }
11
12 console.log('Response:', JSON.stringify(result))
13 return new Response(JSON.stringify(result), {
14 headers: { 'Content-Type': 'application/json' },
15 })
16 } catch (err) {
17 console.error('Function error:', err.message)
18 return new Response(
19 JSON.stringify({ error: err.message }),
20 { status: 500, headers: { 'Content-Type': 'application/json' } }
21 )
22 }
23})
24
25// View output: Dashboard > Logs > Edge Functions

Expected result: Console.log output from your Edge Functions appears in the Dashboard logs with timestamps.

4

Check Postgres logs for query errors and slow queries

Postgres logs show database-level events including query errors, connection issues, and slow queries. Navigate to Dashboard > Logs > Postgres to view them. These logs are particularly useful for debugging RLS policy issues (queries that return empty results unexpectedly), migration failures, and performance problems. Look for ERROR severity entries to find query failures.

typescript
1# Dashboard > Logs > Postgres
2# What you will see:
3# - SQL errors with exact error message and query
4# - Connection pool events
5# - Slow query warnings (if logging is configured)
6# - Migration execution results
7
8# Common Postgres errors in logs:
9# ERROR: permission denied for table todos
10# Missing RLS policy or GRANT
11# ERROR: new row violates row-level security policy
12# INSERT/UPDATE blocked by RLS WITH CHECK
13# ERROR: relation "table_name" does not exist
14# Table not created or wrong schema

Expected result: Postgres logs show database errors and events that help diagnose query and permission issues.

5

Configure log drains for external monitoring

For production applications, you may want to send logs to external monitoring services like Datadog, Logflare, or a custom webhook. Supabase supports log drains on Pro plans and above. Go to Dashboard > Settings > Log Drains to configure a destination. Log drains stream logs in real-time, allowing you to set up alerts, dashboards, and long-term log retention in your preferred monitoring tool.

typescript
1# Dashboard > Settings > Log Drains (Pro+ plans)
2# Supported destinations:
3# - HTTP endpoint (webhook)
4# - Datadog
5# - Logflare (built-in integration)
6
7# Configuration steps:
8# 1. Go to Dashboard > Settings > Log Drains
9# 2. Click 'Add log drain'
10# 3. Select destination type
11# 4. Enter endpoint URL and authentication
12# 5. Select which log sources to include
13# 6. Save and verify logs are flowing
14
15# For HTTP webhook, logs are POSTed as JSON:
16# {
17# "event_message": "...",
18# "timestamp": 1234567890,
19# "metadata": { ... }
20# }

Expected result: Logs are streaming to your external monitoring service in real-time.

Complete working example

edge-function-with-logging.ts
1// Edge Function with structured logging for production debugging
2// supabase/functions/process-order/index.ts
3
4import { createClient } from 'npm:@supabase/supabase-js@2'
5
6const corsHeaders = {
7 'Access-Control-Allow-Origin': '*',
8 'Access-Control-Allow-Headers': 'authorization, x-client-info, apikey, content-type',
9}
10
11// Structured logger for consistent log format
12function log(level: 'info' | 'warn' | 'error', message: string, data?: Record<string, unknown>) {
13 const entry = {
14 level,
15 message,
16 timestamp: new Date().toISOString(),
17 ...data,
18 }
19 if (level === 'error') {
20 console.error(JSON.stringify(entry))
21 } else if (level === 'warn') {
22 console.warn(JSON.stringify(entry))
23 } else {
24 console.log(JSON.stringify(entry))
25 }
26}
27
28Deno.serve(async (req) => {
29 if (req.method === 'OPTIONS') {
30 return new Response('ok', { headers: corsHeaders })
31 }
32
33 const requestId = crypto.randomUUID()
34 log('info', 'Request received', { requestId, method: req.method })
35
36 try {
37 const supabase = createClient(
38 Deno.env.get('SUPABASE_URL')!,
39 Deno.env.get('SUPABASE_ANON_KEY')!,
40 { global: { headers: { Authorization: req.headers.get('Authorization')! } } }
41 )
42
43 const { data: { user } } = await supabase.auth.getUser()
44 if (!user) {
45 log('warn', 'Unauthorized request', { requestId })
46 return new Response(
47 JSON.stringify({ error: 'Unauthorized' }),
48 { status: 401, headers: { ...corsHeaders, 'Content-Type': 'application/json' } }
49 )
50 }
51
52 log('info', 'User authenticated', { requestId, userId: user.id })
53
54 const body = await req.json()
55 const { data, error } = await supabase
56 .from('orders')
57 .insert({ user_id: user.id, ...body })
58 .select()
59 .single()
60
61 if (error) {
62 log('error', 'Database insert failed', { requestId, error: error.message })
63 return new Response(
64 JSON.stringify({ error: error.message }),
65 { status: 500, headers: { ...corsHeaders, 'Content-Type': 'application/json' } }
66 )
67 }
68
69 log('info', 'Order created', { requestId, orderId: data.id })
70 return new Response(
71 JSON.stringify({ order: data }),
72 { status: 201, headers: { ...corsHeaders, 'Content-Type': 'application/json' } }
73 )
74 } catch (err) {
75 log('error', 'Unexpected error', { requestId, error: (err as Error).message })
76 return new Response(
77 JSON.stringify({ error: 'Internal server error' }),
78 { status: 500, headers: { ...corsHeaders, 'Content-Type': 'application/json' } }
79 )
80 }
81})

Common mistakes when enabling and View Logs in Supabase

Why it's a problem: Not checking logs when API requests silently return empty results due to RLS

How to avoid: When queries return empty arrays unexpectedly, check Postgres logs for 'row-level security' messages. Empty results with no error usually mean RLS is blocking access.

Why it's a problem: Logging sensitive user data like passwords, tokens, or personal information in Edge Functions

How to avoid: Only log identifiers (user IDs, request IDs) and operational data. Redact or omit sensitive fields before logging. This prevents data leaks through log storage.

Why it's a problem: Ignoring Edge Function BOOT_ERROR entries in logs, which indicate import or syntax errors

How to avoid: BOOT_ERROR means the function failed to start, usually due to a bad import path or syntax error. Check the error message in the log entry and fix the import statement.

Best practices

  • Check API Gateway logs first when debugging frontend errors — they show the full server-side request and response
  • Use structured JSON logging in Edge Functions for easier parsing and searching in external tools
  • Include request IDs in your logs so you can trace a single request across multiple log entries
  • Filter Postgres logs by ERROR severity to quickly find query failures and permission issues
  • Set up log drains on Pro plans for real-time alerting on errors and performance degradation
  • Avoid logging sensitive data — use user IDs and request IDs instead of full payloads
  • Review Edge Function logs after deployment to catch BOOT_ERROR and TIME_LIMIT issues early

Still stuck?

Copy one of these prompts to get a personalized, step-by-step explanation.

ChatGPT Prompt

I am debugging a Supabase Edge Function that returns a 500 error in production but works locally. Walk me through how to find the error in the Supabase Dashboard logs, what to look for in the Edge Function logs, and how to add structured logging to my function for better debugging.

Supabase Prompt

Add structured JSON logging to my Supabase Edge Function that logs request details, user authentication status, database operation results, and errors. Each log entry should include a request ID for tracing. Show me where to view these logs in the Dashboard.

Frequently asked questions

How long are logs retained in Supabase?

Log retention depends on your plan. Free plan retains logs for 1 day. Pro plan retains logs for 7 days. For longer retention, configure log drains to send logs to an external service with your desired retention period.

Can I search logs by a specific error message?

Yes. Use the search bar in the Logs section to search across log entries. You can search for error messages, paths, status codes, or any text that appears in the log entries.

Why do I see empty Postgres logs?

Postgres logs may appear empty if no errors have occurred recently or if query logging is not enabled for your plan. API Gateway logs are more likely to show activity since they capture all HTTP requests.

How do I see console.log output from Edge Functions?

Console.log, console.warn, and console.error output from Edge Functions appears in Dashboard > Logs > Edge Functions. Filter by function name to isolate a specific function's output.

Are log drains available on the free plan?

No. Log drains are available on Pro plan and above. On the free plan, you can only view logs directly in the Dashboard with 1-day retention.

Can I set up alerts based on log patterns?

Not directly in Supabase. Configure a log drain to send logs to a monitoring service like Datadog or PagerDuty, then set up alerts there based on error patterns, status codes, or response times.

Can RapidDev help set up monitoring and logging for my Supabase project?

Yes. RapidDev can configure log drains, set up structured logging in your Edge Functions, create monitoring dashboards, and implement alerting for your Supabase production environment.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Need help with your project?

Our experts have built 600+ apps and can accelerate your development. Book a free consultation — no strings attached.

Book a free consultation

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.