---
description: >
Learn how to read container logs locally when using a third party logging
solution.
keywords: >
docker, logging, driver, dual logging, dual logging, cache, ring-buffer,
configuration
title: Use docker logs with remote logging drivers
aliases:
- /config/containers/logging/dual-logging/
---
## Overview
You can use the `docker logs` command to read container logs regardless of the
configured logging driver or plugin. Docker Engine uses the [`local`](drivers/local.md)
logging driver to act as cache for reading the latest logs of your containers.
This is called dual logging. By default, the cache has log-file rotation
enabled, and is limited to a maximum of 5 files of 20 MB each (before
compression) per container.
Refer to the [configuration options](#configuration-options) section to customize
these defaults, or to the [disable dual logging](#disable-the-dual-logging-cache)
section to disable this feature.
## Prerequisites
Docker Engine automatically enables dual logging if the configured logging
driver doesn't support reading logs.
The following examples show the result of running a `docker logs` command with
and without dual logging availability:
### Without dual logging capability
When a container is configured with a remote logging driver such as `splunk`, and
dual logging is disabled, an error is displayed when attempting to read container
logs locally:
- Step 1: Configure Docker daemon
```console
$ cat /etc/docker/daemon.json
{
"log-driver": "splunk",
"log-opts": {
"cache-disabled": "true",
... (options for "splunk" logging driver)
}
}
```
- Step 2: Start the container
```console
$ docker run -d busybox --name testlog top
```
- Step 3: Read the container logs
```console
$ docker logs 7d6ac83a89a0
Error response from daemon: configured logging driver does not support reading
```
### With dual logging capability
With the dual logging cache enabled, the `docker logs` command can be used to
read logs, even if the logging driver doesn't support reading logs. The following
example shows a daemon configuration that uses the `splunk` remote logging driver
as a default, with dual logging caching enabled:
- Step 1: Configure Docker daemon
```console
$ cat /etc/docker/daemon.json
{
"log-driver": "splunk",
"log-opts": {
... (options for "splunk" logging driver)
}
}
```
- Step 2: Start the container
```console
$ docker run -d busybox --name testlog top
```
- Step 3: Read the container logs
```console
$ docker logs 7d6ac83a89a0
2019-02-04T19:48:15.423Z [INFO] core: marked as sealed
2019-02-04T19:48:15.423Z [INFO] core: pre-seal teardown starting
2019-02-04T19:48:15.423Z [INFO] core: stopping cluster listeners
2019-02-04T19:48:15.423Z [INFO] core: shutting down forwarding rpc listeners
2019-02-04T19:48:15.423Z [INFO] core: forwarding rpc listeners stopped
2019-02-04T19:48:15.599Z [INFO] core: rpc listeners successfully shut down
2019-02-04T19:48:15.599Z [INFO] core: cluster listeners successfully shut down
```
> [!NOTE]
>
> For logging drivers that support reading logs, such as the `local`, `json-file`
> and `journald` drivers, there is no difference in functionality before or after
> the dual logging capability became available. For these drivers, Logs can be