From e50e4c09db1688eb373d30a370237b550dc7a7a6 Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Thu, 14 Feb 2019 14:55:26 -0800 Subject: [PATCH 1/2] Create local.md --- config/containers/logging/local.md | 55 ++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 config/containers/logging/local.md diff --git a/config/containers/logging/local.md b/config/containers/logging/local.md new file mode 100644 index 0000000000..3ede94950c --- /dev/null +++ b/config/containers/logging/local.md @@ -0,0 +1,55 @@ +--- +description: Describes how to use the json-file logging driver. +keywords: local, protobuf, docker, logging, driver +redirect_from: +- /engine/reference/logging/local/ +- /engine/admin/logging/local/ +title: local binary file Protobuf logging driver +--- + +This `log-driver` writes to `local` binary files using Protobuf [Protocol Buffers](https://en.wikipedia.org/wiki/Protocol_Buffers) + +## Usage + +To use the `local` driver as the default logging driver, set the `log-driver` +and `log-opt` keys to appropriate values in the `daemon.json` file, which is +located in `/etc/docker/` on Linux hosts or +`C:\ProgramData\docker\config\daemon.json` on Windows Server. For more information about +configuring Docker using `daemon.json`, see +[daemon.json](/engine/reference/commandline/dockerd.md#daemon-configuration-file). + +The following example sets the log driver to `local`. + +```json +{ + "log-driver": "local", + "log-opts": {} +} +``` + +> **Note**: `log-opt` configuration options in the `daemon.json` configuration +> file must be provided as strings. Boolean and numeric values (such as the value +> for `max-file` in the example above) must therefore be enclosed in quotes (`"`). + +Restart Docker for the changes to take effect for newly created containers. + +Existing containers will not use the new logging configuration. + +You can set the logging driver for a specific container by using the +`--log-driver` flag to `docker container create` or `docker run`: + +```bash +$ docker run \ + --log-driver local --log-opt compress="false" \ + alpine echo hello world +``` + +### Options + +The `json-file` logging driver supports the following logging options: + +| Option | Description | Example value | +|:------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------| +| `max-size` | The maximum size of each binary log file before rotation. A positive integer plus a modifier representing the unit of measure (`k`, `m`, or `g`). Defaults to `20m`. | `--log-opt max-size=10m` | +| `max-file` | The maximum number of binary log files. If rotating the logs creates an excess file, the oldest file is removed. **Only effective when `max-size` is also set.** A positive integer. Defaults to `5`. | `--log-opt max-file=5` | +| `compress` | Whether or not the binary files should be compressed. Defaults to `true` | `--log-opt compress=true` | From 46c2ef22ab63df32557c337b1e163744158cb51a Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Thu, 14 Feb 2019 14:56:40 -0800 Subject: [PATCH 2/2] Update local.md --- config/containers/logging/local.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/containers/logging/local.md b/config/containers/logging/local.md index 3ede94950c..f8d7cee52e 100644 --- a/config/containers/logging/local.md +++ b/config/containers/logging/local.md @@ -1,5 +1,5 @@ --- -description: Describes how to use the json-file logging driver. +description: Describes how to use the local binary (Protobuf) logging driver. keywords: local, protobuf, docker, logging, driver redirect_from: - /engine/reference/logging/local/