Merge pull request #18737 from dvdksn/dual-logging-refresh

engine: refresh information about dual logging
This commit is contained in:
David Karlsson 2023-11-21 16:50:23 +01:00 committed by GitHub
commit d25b06b03a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 38 deletions

View File

@ -198,14 +198,6 @@ see more options.
| [`gcplogs`](gcplogs.md) | Writes log messages to Google Cloud Platform (GCP) Logging. | | [`gcplogs`](gcplogs.md) | Writes log messages to Google Cloud Platform (GCP) Logging. |
| [`logentries`](logentries.md) | Writes log messages to Rapid7 Logentries. | | [`logentries`](logentries.md) | Writes log messages to Rapid7 Logentries. |
> **Note**
>
> When using Docker Engine 19.03 or older, the [`docker logs` command](../../../engine/reference/commandline/logs.md)
> is only functional for the `local`, `json-file` and `journald` logging drivers.
> Docker 20.10 and up introduces "dual logging", which uses a local buffer that
> allows you to use the `docker logs` command for any logging driver. Refer to
> [reading logs when using remote logging drivers](dual-logging.md) for details.
## Limitations of logging drivers ## Limitations of logging drivers
- Reading log information requires decompressing rotated log files, which causes - Reading log information requires decompressing rotated log files, which causes

View File

@ -1,46 +1,30 @@
--- ---
description: description: >
Learn how to read container logs locally when using a third party logging Learn how to read container logs locally when using a third party logging
solution. solution.
keywords: keywords: >
docker, logging, driver, dual logging, dual-logging, cache, ring-buffer, docker, logging, driver, dual logging, dual logging, cache, ring-buffer,
configuration configuration
title: Use docker logs with remote logging drivers title: Use docker logs with remote logging drivers
--- ---
## Overview ## Overview
Prior to Docker Engine 20.10, the [`docker logs` command](../../../engine/reference/commandline/logs.md) You can use the `docker logs` command to read container logs regardless of the
could only be used with logging drivers that supported for containers using the configured logging driver or plugin. Docker Engine uses the [`local`](local.md)
`local`, `json-file`, or `journald` log drivers. However, many third party logging logging driver to act as cache for reading the latest logs of your containers.
drivers had no support for locally reading logs using `docker logs` 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
This created multiple problems when attempting to gather log data in an
automated and standard way. Log information could only be accessed and viewed
through the third-party solution in the format specified by that
third-party tool.
Starting with Docker Engine 20.10, you can use `docker logs` to read container
logs regardless of the configured logging driver or plugin. This capability,
referred to as "dual logging", allows you to use `docker logs` to read container
logs locally in a consistent format, regardless of the log driver used, because
the engine is configured to log information to the “local” logging driver. Refer
to [Configure the default logging driver](configure.md) for additional information.
Dual logging uses the [`local`](local.md) logging driver to act as cache for
reading the latest logs of your containers. By default, the cache has log-file
rotation enabled, and is limited to a maximum of 5 files of 20MB each (before
compression) per container. compression) per container.
Refer to the [configuration options](#configuration-options) section to customize Refer to the [configuration options](#configuration-options) section to customize
these defaults, or to the [disable dual-logging](#disable-the-dual-logging-cache) these defaults, or to the [disable dual logging](#disable-the-dual-logging-cache)
section to disable this feature. section to disable this feature.
## Prerequisites ## Prerequisites
No configuration changes are needed to use dual logging. Docker Engine 20.10 and Docker Engine automatically enables dual logging if the configured logging
up automatically enable dual logging if the configured logging driver doesn't driver doesn't support reading logs.
support reading logs.
The following examples show the result of running a `docker logs` command with The following examples show the result of running a `docker logs` command with
and without dual logging availability: and without dual logging availability:
@ -124,7 +108,7 @@ as a default, with dual logging caching enabled:
### Configuration options ### Configuration options
The "dual logging" cache accepts the same configuration options as the The dual logging cache accepts the same configuration options as the
[`local` logging driver](local.md), but with a `cache-` prefix. These options [`local` logging driver](local.md), but with a `cache-` prefix. These options
can be specified per container, and defaults for new containers can be set using can be specified per container, and defaults for new containers can be set using
the [daemon configuration file](/engine/reference/commandline/dockerd/#daemon-configuration-file). the [daemon configuration file](/engine/reference/commandline/dockerd/#daemon-configuration-file).

View File

@ -40,8 +40,6 @@ You can set the logging driver for a specific container by using the
$ docker run --log-driver=gcplogs ... $ docker run --log-driver=gcplogs ...
``` ```
The `docker logs` command isn't available for this logging driver.
If Docker detects that it's running in a Google Cloud Project, it discovers If Docker detects that it's running in a Google Cloud Project, it discovers
configuration from the configuration from the
[instance metadata service](https://cloud.google.com/compute/docs/metadata). [instance metadata service](https://cloud.google.com/compute/docs/metadata).