Background
This article is for the clusters running in your cloud account. For Cloud Services cluster, please kindly refer to GCP BAH Logs | How to download logs for Cloud Service clusters in GCP – EnterpriseDB
Postgres logs and Postgres audit logs are stored in the GCP Cloud Storage bucket. This article will introduce how to download the logs.
Prerequisites
The cluster is running in your GCP cloud account.
Step 1 Get the Logs information from Monitoring & Logging
For this cluster, I can get its logs object store is
gs:://logs-bucket-2a43395c-dc53-40db-bdd5-522be116aa36
Step 2 Check the log from GCP console
1. Go to the GCP project, Cloud Storage -> Bucket
2. Filter with the bucket name
Step 3 Download the logs
3.1 Go to the folder with yyyy-mm-dd format
3.2 You will be prompted with the CLI command. like
3.3 Go to Cloud Shell or log in to gcloud CLI.
$ gsutil -m cp -r \ "gs://logs-bucket-fa152a4d-2e5c-4df0-afc3-1dce4add8e03/kubernetes-logs/2023/12/08/customer_postgresql_cluster_cst.var.log.containers.p-gcmc4w28dm-1_default_postgres-b5ed1f5309a2ed135d333ec78b7ba205b45b264e1d7a1bfe867e9f6f920e3e0b.log" \ .