Skip to main content

all_logs

Creates, updates, deletes, gets or lists an all_logs resource.

Overview​

Nameall_logs
TypeResource
Idsupabase.analytics.all_logs

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
errorstring
resultarray

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectrefsql, iso_timestamp_start, iso_timestamp_endExecutes a SQL query on the project's logs.<br /><br />Either the iso_timestamp_start and iso_timestamp_end parameters must be provided.<br />If both are not provided, only the last 1 minute of logs will be queried.<br />The timestamp range must be no more than 24 hours and is rounded to the nearest minute. If the range is more than 24 hours, a validation error will be thrown.<br /><br />Note: Unless the sql parameter is provided, only edge_logs will be queried. See the [log query docs](https:​//supabase.com/docs/guides/monitoring-and-debugging/logs#logs-explorer) for all available sources.<br />

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
refstringSupabase project reference (the Project ID shown in the dashboard under Settings -> General; 20 lowercase letters). Resolved from the SUPABASE_PROJECT_ID environment variable when it is set (x-stackQL-envVar); otherwise it must be supplied on every project-scoped query as WHERE ref = '<ref>'. A WHERE value always takes precedence over the environment. (x-stackQL-envVar: SUPABASE_PROJECT_ID)
iso_timestamp_endstring (date-time)
iso_timestamp_startstring (date-time)
sqlstringCustom SQL query to execute on the logs. See [querying logs](https:​//supabase.com/docs/guides/monitoring-and-debugging/logs#querying-with-the-logs-explorer) for more details.

SELECT examples​

Executes a SQL query on the project's logs.<br /><br />Either the iso_timestamp_start and iso_timestamp_end parameters must be provided.<br />If both are not provided, only the last 1 minute of logs will be queried.<br />The timestamp range must be no more than 24 hours and is rounded to the nearest minute. If the range is more than 24 hours, a validation error will be thrown.<br /><br />Note: Unless the sql parameter is provided, only edge_logs will be queried. See the [log query docs](https:​//supabase.com/docs/guides/monitoring-and-debugging/logs#logs-explorer) for all available sources.<br />

SELECT
error,
result
FROM supabase.analytics.all_logs
WHERE ref = '{{ ref }}' -- required unless SUPABASE_PROJECT_ID is set
AND sql = '{{ sql }}'
AND iso_timestamp_start = '{{ iso_timestamp_start }}'
AND iso_timestamp_end = '{{ iso_timestamp_end }}'
;