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
Access the Logs section in the Dashboard
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.
1# No code needed — access via Dashboard2# Dashboard > Logs (left sidebar)3# Categories:4# - API Gateway: REST API requests (PostgREST, Auth, Storage)5# - Postgres: Database query logs6# - Edge Functions: Function execution logs7# - Auth: Authentication events8# - Storage: File operations9# - Realtime: WebSocket connectionsExpected result: The Logs section is visible in the Dashboard with multiple log categories.
Filter API Gateway logs by status code and path
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.
1# Dashboard > Logs > API Gateway2# Common filters:3# Status: 400, 401, 403, 404, 5004# Method: GET, POST, PATCH, DELETE5# Path: /rest/v1/todos, /auth/v1/token6# Time: Last 1 hour, Last 24 hours, Custom range78# Example: Find all failed auth requests9# Filter: path contains '/auth/' AND status >= 4001011# Example: Find slow API requests12# Sort by response time, look for > 1000msExpected result: Filtered logs show only the requests matching your criteria, making it easy to identify issues.
View Edge Function logs with console.log output
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.
1// In your Edge Function, add logging:2Deno.serve(async (req) => {3 console.log('Request received:', req.method, req.url)45 try {6 const body = await req.json()7 console.log('Request body:', JSON.stringify(body))89 // Your logic here...10 const result = { success: true }1112 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})2425// View output: Dashboard > Logs > Edge FunctionsExpected result: Console.log output from your Edge Functions appears in the Dashboard logs with timestamps.
Check Postgres logs for query errors and slow queries
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.
1# Dashboard > Logs > Postgres2# What you will see:3# - SQL errors with exact error message and query4# - Connection pool events5# - Slow query warnings (if logging is configured)6# - Migration execution results78# Common Postgres errors in logs:9# ERROR: permission denied for table todos10# → Missing RLS policy or GRANT11# ERROR: new row violates row-level security policy12# → INSERT/UPDATE blocked by RLS WITH CHECK13# ERROR: relation "table_name" does not exist14# → Table not created or wrong schemaExpected result: Postgres logs show database errors and events that help diagnose query and permission issues.
Configure log drains for external monitoring
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.
1# Dashboard > Settings > Log Drains (Pro+ plans)2# Supported destinations:3# - HTTP endpoint (webhook)4# - Datadog5# - Logflare (built-in integration)67# Configuration steps:8# 1. Go to Dashboard > Settings > Log Drains9# 2. Click 'Add log drain'10# 3. Select destination type11# 4. Enter endpoint URL and authentication12# 5. Select which log sources to include13# 6. Save and verify logs are flowing1415# 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
1// Edge Function with structured logging for production debugging2// supabase/functions/process-order/index.ts34import { createClient } from 'npm:@supabase/supabase-js@2'56const corsHeaders = {7 'Access-Control-Allow-Origin': '*',8 'Access-Control-Allow-Headers': 'authorization, x-client-info, apikey, content-type',9}1011// Structured logger for consistent log format12function 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}2728Deno.serve(async (req) => {29 if (req.method === 'OPTIONS') {30 return new Response('ok', { headers: corsHeaders })31 }3233 const requestId = crypto.randomUUID()34 log('info', 'Request received', { requestId, method: req.method })3536 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 )4243 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 }5152 log('info', 'User authenticated', { requestId, userId: user.id })5354 const body = await req.json()55 const { data, error } = await supabase56 .from('orders')57 .insert({ user_id: user.id, ...body })58 .select()59 .single()6061 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 }6869 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.
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.
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.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation