Google Professional Cloud DevOps Engineer Question 135
Select 3Google Cloud PlatformYour team has a custom application running on Google Kubernetes Engine (GKE) that writes important operational data to Cloud Logging. You need to create a custom metric to monitor error rates from these logs and set up an alerting policy. Which steps should you take to achieve this goal?
- A
Create a logs-based metric in Cloud Monitoring using a filter that matches error-level entries in the logs.
- B
Export the logs to BigQuery and then use SQL queries to calculate error rates.
- C
Use Cloud Monitoring to define an alerting policy based on the logs-based metric you created.
- D
Enable Cloud Trace in your project to automatically generate error metrics from your logs.
- E
Ensure your logging filter is specific enough to capture only the relevant error logs for the custom metric.
Show answer and explanation
Correct answers: A, C, E
Explanation
To monitor error rates from logs, you should create a logs-based metric in Cloud Monitoring using a filter to capture the relevant data. Once the metric is created, you can define an alerting policy to notify the team when the error rate exceeds a threshold. A specific filter ensures accurate data for the custom metric. Exporting logs to BigQuery or using Cloud Trace is not applicable in this scenario.
- A. Correct.
Creating a logs-based metric in Cloud Monitoring using a filter is the correct first step to capture metrics from logs.
- B. Incorrect.
Exporting logs to BigQuery is unnecessary in this case. Logs-based metrics can directly analyze logs without exporting them to BigQuery.
- C. Correct.
Defining an alerting policy in Cloud Monitoring is essential for notifying your team when the error rate exceeds a defined threshold.
- D. Incorrect.
Enabling Cloud Trace does not help in this scenario as it is used for distributed tracing, not generating custom metrics from logs.
- E. Correct.
Ensuring the logging filter is specific avoids capturing irrelevant data and ensures the custom metric accuracy.