Google Associate Cloud Engineer Question 293
Select 2Google Cloud PlatformYou are a Google Cloud Engineer tasked with exporting logs from Google Cloud Logging to an external system for long-term storage and analysis. Which of the following steps should you take to achieve this using a Google Cloud Storage bucket?
- A
Create a log sink in Cloud Logging and specify the destination as a Cloud Storage bucket.
- B
Ensure that the Google Cloud Storage bucket has the 'logs' IAM role assigned to it.
- C
Configure the sink to use a service account with permission to write to the Cloud Storage bucket.
- D
Set up a Cloud Function to trigger whenever a new log entry is made and write it to Cloud Storage.
Show answer and explanation
Correct answers: A, C
Explanation
To export logs to an external system using Google Cloud Storage, you need to create a log sink in Cloud Logging that specifies the Cloud Storage bucket as the destination. Additionally, the sink must be configured to use a service account with the appropriate permissions to write logs to the Cloud Storage bucket. This setup efficiently directs logs to the desired storage without additional intervention.
- A. Correct.
Creating a log sink and specifying a Cloud Storage bucket as the destination is a necessary step to export logs to external systems.
- B. Incorrect.
IAM roles such as 'logs' do not exist; rather, permissions are granted to service accounts to write to the storage bucket.
- C. Correct.
Configuring the sink to use a service account with write permissions to the Cloud Storage bucket ensures logs can be exported successfully.
- D. Incorrect.
While a Cloud Function could theoretically be used to process logs, it is not necessary for exporting logs directly to Cloud Storage using Cloud Logging sinks.