cli icon indicating copy to clipboard operation
cli copied to clipboard

supabase tail command for logs

Open chasers opened this issue 4 years ago • 2 comments

Feature request

Is your feature request related to a problem? Please describe.

I should be able to tail my Supabase logs from the Supabase CLI.

Logs should include Kong, Postgres, Storage, Functions, Webhooks and logs re any emails sent.

Describe the solution you'd like

supabase tail should stream my logs to my console. Maybe provide an option to limit which kinds of logs e.g. supabase tail -postgres

Logs could be delivered via a websocket connection between the CLI and my Supabase instance.

supabase tail should work with self-hosted and hosted supabase instances.

Describe alternatives you've considered

None really, this is essentially feature parity for other CLI dev tools.

Additional context

chasers avatar Oct 13 '21 20:10 chasers

How do you even view db logs?

plmwd avatar Apr 01 '22 21:04 plmwd

Hi @plmwd , the local postgres logs are stored inside the postgres container, timestamped by the hour.

$ docker exec -it supabase_db_supabase-dev ls -la /var/log/postgresql
total 228
drwxrwxr-t 1 root     postgres   4096 Sep  2 05:54 .
drwxr-xr-x 1 root     root       4096 Jan 27  2022 ..
-rw-r----- 1 postgres postgres 216553 Sep  2 05:55 server_0500_UTC.csv
-rw-r----- 1 postgres postgres    406 Sep  2 05:54 server_0500_UTC.log

We are actively looking into exposing logs explorer in local studio so that it's as easier view and filter Postgres logs. For other services like Kong, the currently supported way is to tail via docker logs.

docker logs -f supabase_kong_supabase-dev

sweatybridge avatar Sep 02 '22 06:09 sweatybridge

Any updates on this?

user72356 avatar Feb 18 '23 02:02 user72356

Hi @plmwd , the local postgres logs are stored inside the postgres container, timestamped by the hour.

$ docker exec -it supabase_db_supabase-dev ls -la /var/log/postgresql
total 228
drwxrwxr-t 1 root     postgres   4096 Sep  2 05:54 .
drwxr-xr-x 1 root     root       4096 Jan 27  2022 ..
-rw-r----- 1 postgres postgres 216553 Sep  2 05:55 server_0500_UTC.csv
-rw-r----- 1 postgres postgres    406 Sep  2 05:54 server_0500_UTC.log

We are actively looking into exposing logs explorer in local studio so that it's as easier view and filter Postgres logs. For other services like Kong, the currently supported way is to tail via docker logs.

docker logs -f supabase_kong_supabase-dev

@sweatybridge are you guys still looking at exposing the local logs in the studio?

user72356 avatar Mar 09 '23 00:03 user72356

Hi @user72356, yes we have just released supabase/logflare docker image. We will be testing integration on self-hosted and CLI in the next few weeks.

sweatybridge avatar Mar 10 '23 01:03 sweatybridge

It seems that the pgsql logs have been disabled. Those are not generated anymore :(

dsebastien avatar Apr 25 '23 05:04 dsebastien

Hi @user72356, yes we have just released supabase/logflare docker image. We will be testing integration on self-hosted and CLI in the next few weeks.

How is this coming along? I saw some docs stating I have to have a Google Cloud account just to see the local logs? Did I understand that correctly?

user72356 avatar May 19 '23 00:05 user72356

I saw some docs stating I have to have a Google Cloud account just to see the local logs? Did I understand that correctly?

Yes, at its current stage logflare does require a GCP account which is rather counter intuitive for local development.

That said, the logflare team is working on supporting postgres as the storage backend. But it's gonna take some time because we have to rework the BigQuery queries as well. You can follow the logflare repo for more status updates.

sweatybridge avatar May 19 '23 05:05 sweatybridge

Just re-enabling the pgsql logs in the docker container would make our lives much easier. Is it a problem to do so while waiting for better options with logflare?

dsebastien avatar May 19 '23 06:05 dsebastien

It seems that the pgsql logs have been disabled. Those are not generated anymore :(

We have changed the postgres logs settings back to stdout so you should be able to get the local postgres logs by docker logs command:

docker logs -f supabase_db_<project>

If you have a long running local development setup and the logs become too much for docker to handle, you can enable logflare to store the logs on BigQuery.

sweatybridge avatar May 19 '23 06:05 sweatybridge