
Answer-first summary for fast verification
Answer: Deploy a Fluentd daemonset to GKE. Then create a customized input and output configuration to tail the log file in the application's pods and write to Stackdriver Logging., Write a script to tail the log file within the pod and write entries to standard output. Run the script as a sidecar container with the application's pod. Configure a shared volume between the containers to allow the script to have read access to /var/log in the application container.
The correct approach involves ensuring that the logs from the third-party application, which cannot be modified, are properly captured and sent to Stackdriver Logging. Option A is not sufficient because the default Stackdriver Kubernetes Engine Monitoring agent configuration does not automatically capture logs written to files within containers, such as /var/log/app_messages.log. Option C suggests an unnecessary and complex migration to GCE, which does not directly address the logging requirement. Option D proposes a viable solution by using a sidecar container to read the log file and output to stdout, which Stackdriver can then capture. However, the most straightforward and efficient method is Option B, which involves deploying a Fluentd daemonset to GKE with a customized configuration to tail the specific log file and send the logs to Stackdriver Logging. This approach leverages Fluentd's flexibility in log collection and forwarding without requiring changes to the application or its container.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
You have a set of applications running on a Google Kubernetes Engine (GKE) cluster with Stackdriver Kubernetes Engine Monitoring enabled. A new third-party containerized application, which cannot be modified or reconfigured, writes logs to /var/log/app_messages.log. How can you ensure these logs are ingested into Stackdriver Logging?
A
Use the default Stackdriver Kubernetes Engine Monitoring agent configuration.
B
Deploy a Fluentd daemonset to GKE. Then create a customized input and output configuration to tail the log file in the application's pods and write to Stackdriver Logging.
C
Install Kubernetes on Google Compute Engine (GCE) and redeploy your applications. Then customize the built-in Stackdriver Logging configuration to tail the log file in the application's pods and write to Stackdriver Logging.
D
Write a script to tail the log file within the pod and write entries to standard output. Run the script as a sidecar container with the application's pod. Configure a shared volume between the containers to allow the script to have read access to /var/log in the application container.