The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
docs: even more wording changes
TzeYiing6dfbad0d4466
diff --git a/apps/reference/docs/guides/platform/logs.mdx b/apps/reference/docs/guides/platform/logs.mdxindex ffd52643f22..0f7d6bb5e7a 100644--- a/apps/reference/docs/guides/platform/logs.mdx+++ b/apps/reference/docs/guides/platform/logs.mdx@@ -4,8 +4,8 @@ title: Loggingdescription: Getting started with Supabase Platform Log Browser----import Tabs from '@theme/Tabs';-import TabItem from '@theme/TabItem';+import Tabs from '@theme/Tabs'+import TabItem from '@theme/TabItem'The Supabase Platform includes a Logs Explorer that allows log tracing and debugging. Log retention is based on your [project's pricing plan](https://supabase.com/pricing).@@ -14,12 +14,11 @@ These features are currently not available for self-hosted and local developmentThis is currently on the roadmap and you can follow the progress in the [Logflare repository](https://github.com/Logflare/logflare).:::-## Product LogsSupabase provides a logging interface specific to each product. Simple regex searching is available through the search bar to search the log event messsage for specific keywords and patterns. You may export and download the log events matching your query as a spreadsheet.-<!--+<!--To update the screenshots, ensure that at least one log line is selected to display the metadata. Can use meme.town as an example.-->@@ -85,6 +84,7 @@ The [Logs Explorer](https://app.supabase.com/project/_/logs-explorer) exposes loYou can access the following logs from the **Sources** drop-down:+- `auth_logs`: GoTrue server logs, containing authentication/authorization activity.- `edge_logs`: Edge network logs, containing request and response metadata retrieved from Cloudflare.- `function_edge_logs`: Edge network logs for only edge functions, containing network requests and response metadata for each execution.@@ -93,12 +93,10 @@ You can access the following logs from the **Sources** drop-down:- `realtime_logs`: Realtime server logs, containing client connection information.- `storage_logs`: Storage server logs, containing object upload and retrieval information.-## Querying with the Logs ExplorerThe Logs Explorer uses BigQuery and supports all [available SQL functions and operators](https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators).-### Timestamp Display and BehaviorEach log entry is stored with a `timestamp` as a `TIMESTAMP` data type. Use the appropriate [timestamp function](https://cloud.google.com/bigquery/docs/reference/standard-sql/timestamp_functions#timestamp) to utilize the `timestamp` field in a query.@@ -108,7 +106,7 @@ Raw top-level timestamp values are rendered as unix microsecond. To render the t```sql-- timestamp column without datetime()select timestamp from ....--- 1664270180000+-- 1664270180000-- timestamp column with datetime()select datetime(timestamp) from ....@@ -128,15 +126,14 @@ For example, to query the edge logs without any joins:```sqlselect timestamp, metadata from edge_logs t```-The resulting `metadata` key is rendered as an array of objects when rendered in the Logs Explorer. This can be better visualized in this diagram, where each square in a column represents a nested object:-+The resulting `metadata` key is rendered as an array of objects when rendered in the Logs Explorer. This can be better visualized in this diagram, where each square in a column represents a nested object:+-To drill down further, we can add in a `cross join unnest()` so that we can work with keys nested below the `metadata` key.--To query for a deeply nested value, we will have to add join for each level:+We can perform a `cross join unnest()` to work with keys nested below the `metadata` key.+To query for a deeply nested value, we will have to add a join for each array level:```sqlselect timestamp, request.method, header.cf_ipcountry@@ -151,42 +148,42 @@ Doing so surfaces the following columns available for selection:This then allows us to select the `method` and `cf_ipcountry` columns. In JS dot notation, the full paths for each selected column are:-- `metadata.[].request.[].method`-- `metadata.[].request.[].headers.[].cf_ipcountry`+- `metadata.[].request.[].method`+- `metadata.[].request.[].headers.[].cf_ipcountry`### LIMIT and Result Row Limitations-The Logs Explorer has a maximum of 1000 rows per run. To optimize your queries, you can add a `LIMIT` to your SQL query, to reduce the number of rows returned even further.+The Logs Explorer has a maximum of 1000 rows per run. Use `LIMIT` to optimize your queries by reducing the number of rows returned further.### Best Practices-1. Include a WHERE statement filtering over **timestamp**+1. Include a filter over **timestamp**- Querying across your entire log retention range might seem appealing, especially when you need to get your query results fast. For **Enterprise** customers that have a large retention range, you run the risk of your queries timing out due additional time required to scan the larger dataset.+Querying your entire log history might seem appealing. For **Enterprise** customers that have a large retention range, you run the risk of timeouts due additional time required to scan the larger dataset.2. Avoid selecting large nested objects. Select individual values instead.- When querying large objects, the columnar storage engine (in this case BigQuery) selects each column associated with each nested key, resulting in a large number of columns being selected. This inadvertently impacts the query speed and may result in timeouts or memory errors, especially for projects with large amounts of logging activity.-- Instead, select only the values required.-- ```sql- -- ❌ Avoid doing this- select- datetime(timestamp),- m as metadata -- <- metadata contains many nested keys- from edge_logs t- cross join unnest(t.metadata) as m;-- -- ✅ Do this- select- datetime(timestamp),- r.method -- <- select only the required values- from edge_logs t- cross join unnest(t.metadata) as m- cross join unnest(m.request) as r- ```+When querying large objects, the columnar storage engine selects each column associated with each nested key, resulting in a large number of columns being selected. This inadvertently impacts the query speed and may result in timeouts or memory errors, especially for projects with a lot of logs.++Instead, select only the values required.++```sql+-- ❌ Avoid doing this+select+ datetime(timestamp),+ m as metadata -- <- metadata contains many nested keys+from edge_logs t+cross join unnest(t.metadata) as m;++-- ✅ Do this+select+datetime(timestamp),+r.method -- <- select only the required values+from edge_logs t+cross join unnest(t.metadata) as m+cross join unnest(m.request) as r+```### Examples and Templates@@ -201,4 +198,4 @@ from edge_logscross join unnest(m.request) AS rcross join unnest(r.headers) AS hwhere h.x_real_ip is not null and r.method = "GET"-```\ No newline at end of file+```