0
0
Supabasecloud~5 mins

Monitoring and logging in Supabase

Choose your learning style9 modes available
Introduction

Monitoring and logging help you watch your app and catch problems early. They show what is happening inside your system in real time or after events.

You want to know if your Supabase database is running smoothly.
You need to find out why your app crashed or slowed down.
You want to track user actions for security or debugging.
You want alerts when something goes wrong in your backend.
You want to improve your app by analyzing usage patterns.
Syntax
Supabase
supabase logs --project-ref <project_ref> --since <time_period>

--project-ref is your unique Supabase project ID.

--since lets you specify how far back to see logs, like '1h' for one hour.

Examples
Shows logs from the last 30 minutes for project 'abc123'.
Supabase
supabase logs --project-ref abc123 --since 30m
Shows logs from the last day for project 'xyz789'.
Supabase
supabase logs --project-ref xyz789 --since 1d
Sample Program

This command fetches the last 10 minutes of logs from the Supabase project with ID 'demo123'. It helps you see recent events and errors.

Supabase
supabase logs --project-ref demo123 --since 10m
OutputSuccess
Important Notes

You can combine monitoring with alerts to get notified automatically.

Logs can be filtered by severity like INFO, WARN, ERROR to find issues faster.

Supabase also supports real-time monitoring dashboards in its web console.

Summary

Monitoring and logging help you keep your app healthy and fix problems quickly.

Use the supabase logs command with your project ID and time range to see recent events.

Check logs regularly and set alerts for better app reliability.