Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.
Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Store Multiple projects into one Cloud storage

Hello,

I have more than one project and I currently created a centralized logging for specific logs from all my projects to one project (where my central logging bucket is) but I also want to store all of my projects logs to one Centralized Cloud Storage for archiving. When I configure log router, 

Select sink service: Other project
Sink Destination: [Add the Cloud Storage, Pub/Sub, BigQuery or Logging Google Cloud project as a string. For information on project name formatting, go to sink destination documentation.]

Cloud Storage is one of the destination options aside from Pub/Sub, Bigquery or Logging but there seems to be no project name formatting for Cloud storage unlike logging, pub/sub, cloud storage and the link provided doesn't really help.

https://cloud.google.com/logging/docs/routing/overview?_ga=2.48701934.-936891525.1655177724&_gac=1.2...

Is there any documentation to achieve this? I can't find anything helpful on the net. Hoping for your help. Thanks

0 3 986
3 REPLIES 3

ErnestoC
Former Googler

I assume you are referring to the resource name of the Cloud Storage bucket which will be used as the destination for your logging sink.

The documentation is indeed not clear on the scenario where the bucket is located in a different project, but from this reference in the REST API for Cloud Logging, the correct format is shown:

storage.googleapis.com/[GCS_BUCKET]

I tested creating a logging sink with this format, and could see the logs stored in the bucket at the second project. 

Keep in mind you need to assign the proper IAM role (Storage Object Creator) to the sink service account (i.e unique writer identity) on your Cloud Storage bucket at the other project. You might also have to wait up to an hour for logs to appear in the bucket.

hi ErnestoC,

thanks for provided the answer, you have mentioned as "storage.googleapis.com/[GCS_BUCKET]"

here, i am also trying to collect and route the logs from Project A to Project B
Project A - Created Sink
Project B - Created Cloud Storage bucket

can you share the format which i need to use for GCS Bucket
here trying to route the logs from Project A to Project B Storage bucket,
to fill the GCS Bucket entry, not required to mention the Project ID of Project B?
can you please provide the detailed format which we need to use it here.

one more thing, as per this link https://cloud.google.com/logging/docs/export/configure_export_v2

Other Cloud project: Manually add the Logging, BigQuery, Cloud Storage, or Pub/Sub service and destination information in the following format:

SERVICE.googleapis.com/projects/PROJECT_ID/SINK_DESTINATION - trying to get the sample values for this format

Confused with the above link details and your answer, can you help me to understand and try to create Log Routing Sink in Project A and move the logs from Project A to Cloud Storage in Project B.

 

i tried this option, working fine

 so anyone facing similar issue , hope this will help

added my inputs from the above given steps

1.(Project A)Host Project Sink Service Name - Other Project
2.Sink Designation - storage.googleapis.com/[GCS_BUCKET]   - Use the GCS Bucket created in the service project(Project B)
3.copy the service account from Sink Writer Identlty
4.Under Service project, give permission to this service account to storage object creator role under storage bucket
5.After 1 hr logs movement happened and available in the cloud storage bucket