Google Associate Cloud Engineer Question 304
Select 2Google Cloud PlatformAs a Google Cloud Associate Cloud Engineer, you are tasked with troubleshooting an application running on Google Kubernetes Engine (GKE). You need to view and filter the logs to find specific error messages related to a particular microservice running in the cluster. Which of the following steps should you take in the Google Cloud Console to efficiently filter these logs?
- A
Navigate to the Cloud Logging page, select the relevant GKE cluster, and use the filter bar to specify the microservice name and error severity.
- B
Go to the Cloud Monitoring page, create a new dashboard, and add a log-based metric to filter the error logs.
- C
Open the Cloud Logging page, click on the Logs Explorer, and use the query builder to filter logs by the microservice label and error severity.
- D
Access the GKE page, select the cluster, and use the 'kubectl logs' command to filter logs by microservice and error type.
Show answer and explanation
Correct answers: A, C
Explanation
To efficiently filter logs in Google Cloud Platform, you should use the Cloud Logging interface. The Cloud Logging page and Logs Explorer are specifically designed for viewing and filtering logs. They provide tools to filter logs by various criteria, such as microservice labels and error severity, making them suitable for troubleshooting applications running in GKE.
- A. Correct.
This option is correct because the Cloud Logging page allows you to select specific resources and use the filter bar to narrow down logs by criteria such as microservice name and severity.
- B. Incorrect.
This option is incorrect because Cloud Monitoring is used for metrics and dashboards, not directly for filtering logs.
- C. Correct.
This option is correct as the Logs Explorer in Cloud Logging provides a query builder feature that allows for detailed filtering of logs by labels and severity.
- D. Incorrect.
This option is incorrect because while 'kubectl logs' can be used to view logs, it is not part of the Cloud Console and is not efficient for filtering logs at scale in the console.