209k views
0 votes
What is the Docker logging driver sample configuration?

A) --log-driver=console
B) --log-driver=none
C) --log-driver=syslog
D) --log-driver=json-file

1 Answer

1 vote

Final Answer:

This Docker logging driver is commonly used to write container logs as JSON objects to a file on the host system, providing a structured format for log data. To learn more about Docker logging drivers and their configurations, explore the documentation. The correct option is D) --log-driver=json-file.

Step-by-step explanation:

Docker logging drivers play a crucial role in determining how the logs generated by containers are handled and where they are stored. Among the given options, option D) --log-driver=json-file stands out as a commonly employed configuration.

When this logging driver is specified, Docker writes container logs in the form of JSON objects to a file on the host system. This choice offers a structured and machine-readable format for log data, which can be beneficial for various purposes, such as easy parsing and analysis.

The use of JSON file logging is particularly advantageous in environments where structured log data is preferred or required. It allows for straightforward integration with tools that can efficiently process and analyze JSON-formatted logs, aiding in tasks such as monitoring, debugging, and performance analysis. Additionally, the file-based approach ensures that logs are persistently stored on the host system, making them accessible for future reference or external log management systems.

User Ubershmekel
by
7.8k points