Google Associate Cloud Engineer Question 308
Select 3Google Cloud PlatformYou are a Google Cloud engineer tasked with diagnosing an issue in your cloud application. You need to view detailed log messages related to a specific Compute Engine instance within your project using Google Cloud Logging. Which of the following steps should you take to achieve this?
- A
Navigate to the Logs Explorer in the Google Cloud Console.
- B
Use the 'gcloud logging read' command with the appropriate filters.
- C
Access the instance logs directly through the Compute Engine instance terminal.
- D
Filter logs in the Logs Explorer using the instance name and severity level.
- E
Set up a logging sink to export logs to BigQuery for detailed analysis.
Show answer and explanation
Correct answers: A, B, D
Explanation
To view specific log message details in Cloud Logging, you can use the Logs Explorer in the Google Cloud Console to visually navigate and filter logs or use the 'gcloud logging read' command for programmatic access. Filtering by instance name and severity level helps in pinpointing the required log messages. Direct access to logs is not done via the instance terminal, and exporting logs to BigQuery is typically used for in-depth analysis rather than immediate viewing.
- A. Correct.
This is the correct first step to view logs in the Google Cloud Console, where you can explore and filter logs.
- B. Correct.
Using the 'gcloud logging read' command with filters allows you to retrieve specific logs from the command line.
- C. Incorrect.
Instance logs are not directly accessed through the terminal. Logs are centralized in Cloud Logging.
- D. Correct.
Filtering logs by instance name and severity level in the Logs Explorer can help narrow down the specific log messages you want to investigate.
- E. Incorrect.
Setting up a logging sink to export logs to BigQuery is more suited for long-term analysis and not necessary for immediate log viewing in Cloud Logging.