Google Associate Cloud Engineer Question 299
Select 3Google Cloud PlatformYou are managing a Google Cloud Platform project where you need to set up logging for multiple applications across different environments, such as development, staging, and production. You want to ensure that logs are routed to different log buckets based on the environment for better management and cost control. Which of the following steps should you take to achieve this setup?
- A
Create separate log buckets for each environment in your Cloud project.
- B
Configure log sinks with filters to route logs to the appropriate log buckets based on environment labels.
- C
Set up IAM roles to allow only specific users to access certain log buckets.
- D
Enable log analytics on each log bucket to automatically categorize logs by environment.
- E
Use Pub/Sub to export logs from Stackdriver to external systems for further analysis.
Show answer and explanation
Correct answers: A, B, C
Explanation
To manage logs efficiently for different environments, you need to create separate log buckets for each environment and configure log sinks with appropriate filters to route the logs. Additionally, setting up IAM roles ensures proper access control. While log analytics and Pub/Sub are useful, they do not directly contribute to routing logs based on environment.
- A. Correct.
Creating separate log buckets for each environment allows you to isolate logs and manage them effectively based on the environment they belong to.
- B. Correct.
Configuring log sinks with filters ensures that only logs from the specified environment are routed to the designated log buckets.
- C. Correct.
Setting up IAM roles is essential to control access to the logs, ensuring that only authorized users can view or manage logs from specific environments.
- D. Incorrect.
Enabling log analytics helps in analyzing logs but does not automatically categorize them by environment. This needs to be done through log sinks and filters.
- E. Incorrect.
Using Pub/Sub to export logs is a valid approach for external analysis but not necessary for routing logs to different buckets based on environments.