Erik M
Erik M

Reputation: 23

Setting Google Cloud Platform Log sink to a specific folder within a bucket

I have created five separate log export sinks within Google Cloud Stackdriver. Currently they are all set to the same bucket (my-bucket) with the destination:

storage.googleapis.com/my-bucket

The bucket (my-bucket) has the following 5 folders: iam, compute, firewall, project and storage

I would like to associate each log sink to one of those folders within my bucket, is this possible? The answer from a related question (Pointing multiple projects' log sinks to one bucket) seems to indicate that it is, however, I do not understand the "FOLDER_ID" and if this is what I need and if so where do I get that.

I have tried to update the destination manually in google cloud shell with the command

gcloud logging sinks update my-compute-log-sink storage.googleapis.com/my-bucket/compute

and get confirmation that the sink has been updated, however, running gcloud logging sinks list shows no change and now I am stuck.

Upvotes: 2

Views: 2212

Answers (2)

neilH
neilH

Reputation: 3438

This isn't currently possible.

The location you used when attempting to update the sink (when you include the directory) will only point to the bucket as a whole despite adding the additional information after it, so when you see the updated message, you are probably overwriting the current sink with the same information as before.

I've opened a feature request to see if it will be possible to implement the usage of specified bucket directory locations in Google Cloud Platform logging sinks. You can follow it here:

https://issuetracker.google.com/72036905

There is also a separate feature request which relates to the task you are trying to acehive that you can follow here:

https://issuetracker.google.com/69371200

In terms of the FOLDER_ID value, that's not related to the folder in the bucket, but relates to the Cloud Platform Resource Hierarchy as explained here. It's therefore not something related to your main issue.

Upvotes: 0

Kirk Kelsey
Kirk Kelsey

Reputation: 4544

The logging sink destination (for cloud storage) must be a bucket.

The folder referred to in the answer to Pointing multiple projects' log sinks to one bucket is for grouping projects. That answer links to the documentation for folders, which describes them as:

Folders are nodes in the Cloud Platform Resource Hierarchy. A folder can contain projects, other folders, or a combination of both.

Cloud Storage does not support something like 'folders' within buckets, only buckets and objects. See https://cloud.google.com/storage/docs/key-terms

Upvotes: 0

Related Questions