Google Associate Cloud Engineer Question 309
Select 2Google Cloud PlatformYou are tasked with troubleshooting a specific issue in your application running on Google Cloud Platform. You need to view detailed log messages from your Compute Engine instances that match a specific error code. Which of the following steps should you take in Google Cloud Console to achieve this?
- A
Navigate to Cloud Logging and use the filter bar to enter the specific error code.
- B
Export the logs to BigQuery and run a SQL query to filter by the error code.
- C
Use the gcloud command-line tool to view logs and apply a filter for the specific error code.
- D
Create a Cloud Function to process logs and find those with the specific error code.
- E
Set up a log-based metric and use Cloud Monitoring to filter by the error code.
Show answer and explanation
Correct answers: A, C
Explanation
To view specific log message details in Cloud Logging for troubleshooting, the most efficient methods are using the filter bar in the Cloud Logging interface or using the gcloud command-line tool to apply filters. These methods allow direct access to logs based on specific criteria such as error codes, without the need for additional processing or exporting steps.
- A. Correct.
Using the filter bar in Cloud Logging is a direct way to search and view log entries by specific attributes such as error codes.
- B. Incorrect.
Exporting logs to BigQuery is a complex, multi-step process not necessary for viewing specific log entries directly in Cloud Logging.
- C. Correct.
The gcloud command-line tool offers a way to filter and view logs directly from the command line, suitable for finding specific error codes.
- D. Incorrect.
Creating a Cloud Function for this task would be overly complex and not the intended use case for viewing specific logs.
- E. Incorrect.
Setting up a log-based metric is meant for monitoring over time and not for immediate log inspection for specific error codes.