Docker - Logging and MonitoringYou want to forward Docker container logs to both Fluentd and a local file simultaneously. Which solution best achieves this?AConfigure Fluentd to write logs to a local fileBSet the log driver to 'json-file' onlyCRun two containers with the same image, one logging to Fluentd and one to fileDUse a logging driver that supports multiple outputs or run a sidecar container to duplicate logsCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand Docker logging driver limitationsDocker logging drivers typically support one output destination per container.Step 2: Identify multi-output solutionsUsing a logging driver that supports multiple outputs or a sidecar container to duplicate logs can achieve forwarding to multiple destinations.Final Answer:Use a logging driver that supports multiple outputs or run a sidecar container to duplicate logs -> Option DQuick Check:Multi-output needs special drivers or sidecar duplication [OK]Quick Trick: Use sidecar or multi-output driver to send logs to multiple places [OK]Common Mistakes:Assuming one log driver can send to multiple outputs by defaultOnly setting json-file driverRunning duplicate containers instead of duplicating logs
Master "Logging and Monitoring" in Docker9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Docker Quizzes Docker Security - Read-only filesystem containers - Quiz 13medium Docker Security - Content trust and image signing - Quiz 13medium Docker Security - User namespace remapping - Quiz 5medium Docker Security - Running containers as non-root - Quiz 15hard Docker Swarm - Why orchestration matters - Quiz 12easy Docker Swarm - Swarm vs Kubernetes decision - Quiz 7medium Logging and Monitoring - Why monitoring containers matters - Quiz 12easy Logging and Monitoring - Docker events monitoring - Quiz 6medium Resource Management - System prune for cleanup - Quiz 6medium Resource Management - System prune for cleanup - Quiz 1easy