DCA practice question 22 of 25

Your organization has a centralized logging solution, such as Splunk. Will this configure a Docker container to export container logs to the logging solution? Solution: Set the log-driver and log-oPt keys to values for the logging solution (Splunk) In the daemon.json file.

Full set: 191 questions
Answer options
A: Yes Correct answer
B: No
Correct Answer:
A. Yes
Explanation

The daemon.json file is the standard method for configuring the Docker daemon's default settings. By setting the log-driver key, you define the default logging driver for all new containers started by that daemon. The log-opts key is used to pass specific configuration options required by that driver, such as the token and URL for a Splunk collector. This approach centralizes the logging configuration at the host level, ensuring all containers automatically forward their logs to the specified external system without needing individual configuration.

Why Incorrect

B: This is incorrect. Configuring the daemon.json file is the primary and officially documented method for setting a default logging driver for all containers on a Docker host.

References

1. Docker Docs, "Configure logging drivers", Daemon configuration file section. The documentation explicitly states: "To configure the Docker daemon to default to a specific logging driver, set the value of log-driver to the name of the logging driver in the daemon.json file."

2. Docker Docs, "Splunk logging driver". This page details the specific log-opts available for the Splunk driver, such as splunk-token and splunk-url, which are configured in the daemon.json file.

Scroll to Top