Merge pull request #10568 from LK4D4/logging_drivers

Logging drivers
Upstream-commit: 1ff5a91007f01d2d61a7b2066db2e164085f0d1b
Component: engine
This commit is contained in:
Arnaud Porterie
2015-03-17 09:45:58 -07:00
23 changed files with 615 additions and 50 deletions
@@ -28,6 +28,7 @@ docker-create - Create a new container
[**--label-file**[=*[]*]]
[**--link**[=*[]*]]
[**--lxc-conf**[=*[]*]]
[**--log-driver**[=*[]*]]
[**-m**|**--memory**[=*MEMORY*]]
[**--memory-swap**[=*MEMORY-SWAP*]]
[**--mac-address**[=*MAC-ADDRESS*]]
@@ -116,6 +117,10 @@ IMAGE [COMMAND] [ARG...]
**--lxc-conf**=[]
(lxc exec-driver only) Add custom lxc options --lxc-conf="lxc.cgroup.cpuset.cpus = 0,1"
**--log-driver**="|*json-file*|*none*"
Logging driver for container. Default is defined by daemon `--log-driver` flag.
**Warning**: `docker logs` command works only for `json-file` logging driver.
**-m**, **--memory**=""
Memory limit (format: <number><optional unit>, where unit = b, k, m or g)
@@ -22,6 +22,8 @@ The **docker logs --follow** command combines commands **docker logs** and
**docker attach**. It will first return all logs from the beginning and
then continue streaming new output from the containers stdout and stderr.
**Warning**: This command works only for **json-file** logging driver.
# OPTIONS
**--help**
Print usage statement
@@ -29,6 +29,7 @@ docker-run - Run a command in a new container
[**--label-file**[=*[]*]]
[**--link**[=*[]*]]
[**--lxc-conf**[=*[]*]]
[**--log-driver**[=*[]*]]
[**-m**|**--memory**[=*MEMORY*]]
[**--memory-swap**[=*MEMORY-SWAP]]
[**--mac-address**[=*MAC-ADDRESS*]]
@@ -217,6 +218,10 @@ which interface and port to use.
**--lxc-conf**=[]
(lxc exec-driver only) Add custom lxc options --lxc-conf="lxc.cgroup.cpuset.cpus = 0,1"
**--log-driver**="|*json-file*|*none*"
Logging driver for container. Default is defined by daemon `--log-driver` flag.
**Warning**: `docker logs` command works only for `json-file` logging driver.
**-m**, **--memory**=""
Memory limit (format: <number><optional unit>, where unit = b, k, m or g)
+4
View File
@@ -89,6 +89,10 @@ unix://[/path/to/socket] to use.
**--label**="[]"
Set key=value labels to the daemon (displayed in `docker info`)
**--log-driver**="*json-file*|*none*"
Container's logging driver. Default is `default`.
**Warning**: `docker logs` command works only for `json-file` logging driver.
**--mtu**=VALUE
Set the containers network mtu. Default is `0`.
@@ -161,7 +161,8 @@ Create a container
"RestartPolicy": { "Name": "", "MaximumRetryCount": 0 },
"NetworkMode": "bridge",
"Devices": [],
"Ulimits": [{}]
"Ulimits": [{}],
"LogConfig": { "Type": "json-file", Config: {} }
}
}
@@ -255,6 +256,10 @@ Json Parameters:
- **Ulimits** - A list of ulimits to be set in the container, specified as
`{ "Name": <name>, "Soft": <soft limit>, "Hard": <hard limit> }`, for example:
`Ulimits: { "Name": "nofile", "Soft": 1024, "Hard", 2048 }}`
- **LogConfig** - Logging configuration to container, format
`{ "Type": "<driver_name>", "Config": {"key1": "val1"}}
Available types: `json-file`, `none`.
`json-file` logging driver.
Query Parameters:
@@ -352,6 +357,7 @@ Return low-level information on the container `id`
"MaximumRetryCount": 2,
"Name": "on-failure"
},
"LogConfig": { "Type": "json-file", Config: {} },
"SecurityOpt": null,
"VolumesFrom": null,
"Ulimits": [{}]
@@ -448,6 +454,9 @@ Status Codes:
Get stdout and stderr logs from the container ``id``
> **Note**:
> This endpoint works only for containers with `json-file` logging driver.
**Example request**:
GET /containers/4fa6e0f0c678/logs?stderr=1&stdout=1&timestamps=1&follow=1&tail=10 HTTP/1.1
@@ -97,6 +97,7 @@ expect an integer, and they can only be specified once.
--ipv6=false Enable IPv6 networking
-l, --log-level="info" Set the logging level
--label=[] Set key=value labels to the daemon
--log-driver="json-file" Container's logging driver (json-file/none)
--mtu=0 Set the containers network MTU
-p, --pidfile="/var/run/docker.pid" Path to use for daemon PID file
--registry-mirror=[] Preferred Docker registry mirror
@@ -817,6 +818,7 @@ Creates a new container.
-l, --label=[] Set metadata on the container (e.g., --label=com.example.key=value)
--label-file=[] Read in a line delimited file of labels
--link=[] Add link to another container
--log-driver="" Logging driver for container
--lxc-conf=[] Add custom lxc options
-m, --memory="" Memory limit
--mac-address="" Container MAC address (e.g. 92:d0:c6:0a:29:33)
@@ -1447,6 +1449,9 @@ For example:
-t, --timestamps=false Show timestamps
--tail="all" Number of lines to show from the end of the logs
NOTE: this command is available only for containers with `json-file` logging
driver.
The `docker logs` command batch-retrieves logs present at the time of execution.
The `docker logs --follow` command will continue streaming the new output from
@@ -1722,6 +1727,7 @@ To remove an image using its digest:
-i, --interactive=false Keep STDIN open even if not attached
--ipc="" IPC namespace to use
--link=[] Add link to another container
--log-driver="" Logging driver for container
--lxc-conf=[] Add custom lxc options
-m, --memory="" Memory limit
-l, --label=[] Set metadata on the container (e.g., --label=com.example.key=value)
@@ -642,6 +642,20 @@ familiar with using LXC directly.
> you can use `--lxc-conf` to set a container's IP address, but this will not be
> reflected in the `/etc/hosts` file.
## Logging drivers (--log-driver)
You can specify a different logging driver for the container than for the daemon.
### Logging driver: none
Disables any logging for the container. `docker logs` won't be available with
this driver.
### Log driver: json-file
Default logging driver for Docker. Writes JSON messages to file. `docker logs`
command is available only for this logging driver
## Overriding Dockerfile image defaults
When a developer builds an image from a [*Dockerfile*](/reference/builder)