
What Is the Default json-file Logging Driver?
Docker’s default logging driver isjson-file. It collects container output and writes it as JSON objects on the host filesystem.
To confirm your daemon’s default driver:
json-file:
Where Are json-file Logs Stored?
By default, log files are stored under/var/lib/docker/containers/<container-id>. Each container directory contains a file named <container-id>-json.log:
Rotating or cleaning up old JSON logs prevents disk exhaustion. Consider using Docker’s
log-opts settings like max-size and max-file.Supported Docker Logging Drivers
Beyondjson-file, Docker integrates with multiple logging backends. Choose the one that matches your infrastructure for centralized log aggregation:
| Driver | Use Case | More Info |
|---|---|---|
| awslogs | Send logs to Amazon CloudWatch Logs | AWS CloudWatch Logs |
| fluentd | Forward logs to a Fluentd collector | Fluentd |
| gcplogs | Ship logs to Google Cloud Logging | Google Cloud Logging |
| gelf | Graylog Extended Log Format | GELF Specs |
| journald | Use systemd’s journald | journald |
| splunk | Forward to Splunk | Splunk Docs |
| syslog | Standard syslog protocol | — |
| local | Fast, built-in local driver | — |
| none | Disable logging (no docker logs) | — |
Using the
none driver disables all logs for the container. Only use this when you intentionally want zero log output.Changing the Daemon’s Default Logging Driver
To set a different default logging driver, modify (or create)/etc/docker/daemon.json:
Overriding the Logging Driver Per Container
You can override the daemon default for individual containers with the--log-driver flag:
--log-opt:
Inspecting a Container’s Logging Configuration
To verify which logging driver a container is using:HostConfig.LogConfig section: