01 Run projects list command (Windows/macOS/Linux) using custom query filters to list the IDs of all the projects available in your Google Cloud account:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
gcloud projects list
--format="table(projectId)"
02 The command output should return the requested GCP project IDs:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
PROJECT_ID
tm-project5-123123
tm-web-prod-123456
03 Run logging buckets list command (Windows/macOS/Linux) using the ID of the GCP project that you want to examine as the identifier parameter and custom query filters to describe the full name of each log bucket available within the selected project, including the system buckets, i.e. _Default and _Required:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
gcloud logging buckets list
--project=tm-project5-123123
--format="json(name)"
04 The command output should return the full name of of each log bucket available. The full name indicates the name of the project and the bucket location:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
[
{
"name": "projects/tm-project5-123123/locations/global/buckets/tm-server-access-logs-bucket"
},
{
"name": "projects/tm-project5-123123/locations/global/buckets/tm-project5-logs-bucket"
},
{
"name": "projects/tm-project5-123123/locations/global/buckets/_Default"
},
{
"name": "projects/tm-project5-123123/locations/global/buckets/_Required"
}
]
05 Run logging buckets describe command (Windows/macOS/Linux) using name of the log bucket that you want to examine as the identifier parameter, excluding the _Required bucket, to describe the log data retention period configured for the selected bucket:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
gcloud logging buckets describe tm-server-access-logs-bucket
--project=tm-project5-123123
--location=global
--format="yaml(retentionDays)"
06 The command output should return the retention period configured for the specified log bucket:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
retentionDays: 45
Check the
retentionDays attribute value to determine the number of days to retain data for the selected log bucket. If the
retentionDays value is less than 365 days, the selected Cloud Logging bucket does not have a sufficient log data retention period configured.
07 Repeat steps no. 5 and 6 for each log bucket that you want to examine, available for the selected project.
08 Repeat step no. 3 – 7 for each GCP project available within your Google Cloud account.