
Answer-first summary for fast verification
Answer: Install the Stackdriver Logging Agent and configure it to send the application logs.
The correct approach is to use the Stackdriver Logging Agent. The agent (now part of Google Cloud's operations suite) can be installed on the Compute Engine instance and configured to monitor custom log files written by the application. This requires no code changes, as the agent reads logs directly from the disk. Option B involves code changes (using a library), which the question prohibits. Option C is incorrect because metadata alone does not configure log collection. Option D is invalid as changing the application's logging path would require modifying its code, which is not allowed.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
You are deploying an application to a Compute Engine VM instance. The application writes logs to disk, but you want to view these logs in Stackdriver Logging without modifying the application code.
What should you do?
A
Install the Stackdriver Logging Agent and configure it to send the application logs.
B
Use a Stackdriver Logging Library to log directly from the application to Stackdriver Logging.
C
Provide the log file folder path in the metadata of the instance to configure it to send the application logs.
D
Change the application to log to /var/log so that its logs are automatically sent to Stackdriver Logging.
No comments yet.