0
0
Dockerdevops~20 mins

Centralized logging setup in Docker - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Centralized Logging Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Docker logging driver output
You run a Docker container with the command:
docker run --log-driver=json-file --name test-container alpine echo hello

What will be the output of docker logs test-container?
Ahello
BNo output, because json-file driver does not store logs
CError: logging driver not supported
DContainer logs are empty
Attempts:
2 left
💡 Hint
The json-file logging driver stores container stdout and stderr logs locally.
Configuration
intermediate
2:00remaining
Configure Docker to use syslog logging driver
Which Docker daemon configuration snippet correctly sets the default logging driver to syslog?
A
{
  "log_driver": "syslog"
}
B
{
  "logging-driver": "syslog"
}
C
{
  "log-driver": "syslog"
}
D
{
  "logdriver": "syslog"
}
Attempts:
2 left
💡 Hint
Docker daemon config uses kebab-case keys with hyphens.
🔀 Workflow
advanced
2:00remaining
Centralized logging with ELK stack and Docker
You want to send Docker container logs to an ELK (Elasticsearch, Logstash, Kibana) stack. Which logging driver should you configure on your containers to send logs directly to Logstash over TCP?
Ajson-file
Bsyslog
Cfluentd
Dgelf
Attempts:
2 left
💡 Hint
GELF is a logging format supported by Logstash for structured logs over TCP/UDP.
Troubleshoot
advanced
2:00remaining
Docker logs missing after configuring syslog driver
After configuring Docker containers to use the syslog logging driver, you notice docker logs shows no output. Why does this happen?
ASyslog driver sends logs outside Docker, so 'docker logs' cannot access them
BSyslog driver disables container stdout and stderr
CDocker daemon crashed and lost logs
DThe container did not produce any logs
Attempts:
2 left
💡 Hint
Syslog driver forwards logs to the host syslog service, not stored in Docker's local log files.
Best Practice
expert
3:00remaining
Best practice for centralized logging in a multi-host Docker swarm
In a Docker Swarm with multiple hosts, what is the best practice to collect and centralize logs from all containers across hosts?
AConfigure each container to use the json-file driver and manually copy log files from each host
BUse a centralized logging agent like Fluentd or Logstash on each host to collect container logs and forward them to a central server
CUse the default Docker logging driver and rely on 'docker logs' command on each host separately
DDisable logging to improve performance and avoid log storage
Attempts:
2 left
💡 Hint
Centralized logging agents can collect logs from multiple sources and forward them reliably.