Google Cloud DevOps Certification Practice Test

Question: 1 / 400

If a third-party application in GKE cannot be modified and writes logs to a specific file, what is the best way to forward those logs to Cloud Logging?

Deploy a Fluentd daemonset to GKE with configurations to tail the log file.

Write a script to tail the log file and run it as a sidecar container with the application's pod.

Using a sidecar container alongside the application’s pod to tail the log file is an effective strategy for a third-party application whose code cannot be altered. In this scenario, the application is set up to write logs to a specific file, which makes it necessary to find a way to capture and forward those logs without direct modification to the application.

The sidecar pattern works by running a separate container in the same pod as the primary application container. This sidecar container can be configured specifically to access the log file, using a script that tails the file and reads log entries as they are written. The sidecar can then take care of forwarding these logs to Cloud Logging, ensuring that the logs are properly collected without disrupting the operation of the main application.

This method provides a clear advantage: it isolates the log collection process from the main application, allowing for flexibility in managing the logs without requiring any changes to the third-party application. Additionally, it maintains the architecture of Kubernetes, where each pod can have multiple containers working in unison.

The other options, while they may seem viable, have inherent drawbacks in this context. Deploying a Fluentd daemonset could be less optimal if the logging configuration is highly specific and tailored just for the third-party application, as

Get further explanation with Examzify DeepDiveBeta

Use a logging agent that automatically detects and forwards application logs.

Modify the application to directly log to Cloud Logging.

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy