|
@@ -27,12 +27,15 @@ container's logging driver. The following options are supported:
|
|
|
|
|
|
The `docker logs`command is available only for the `json-file` logging driver.
|
|
The `docker logs`command is available only for the `json-file` logging driver.
|
|
|
|
|
|
|
|
+
|
|
## json-file options
|
|
## json-file options
|
|
|
|
|
|
The following logging options are supported for the `json-file` logging driver:
|
|
The following logging options are supported for the `json-file` logging driver:
|
|
|
|
|
|
--log-opt max-size=[0-9+][k|m|g]
|
|
--log-opt max-size=[0-9+][k|m|g]
|
|
--log-opt max-file=[0-9+]
|
|
--log-opt max-file=[0-9+]
|
|
|
|
+ --log-opt labels=label1,label2
|
|
|
|
+ --log-opt env=env1,env2
|
|
|
|
|
|
Logs that reach `max-size` are rolled over. You can set the size in kilobytes(k), megabytes(m), or gigabytes(g). eg `--log-opt max-size=50m`. If `max-size` is not set, then logs are not rolled over.
|
|
Logs that reach `max-size` are rolled over. You can set the size in kilobytes(k), megabytes(m), or gigabytes(g). eg `--log-opt max-size=50m`. If `max-size` is not set, then logs are not rolled over.
|
|
|
|
|
|
@@ -41,6 +44,26 @@ Logs that reach `max-size` are rolled over. You can set the size in kilobytes(k)
|
|
|
|
|
|
If `max-size` and `max-file` are set, `docker logs` only returns the log lines from the newest log file.
|
|
If `max-size` and `max-file` are set, `docker logs` only returns the log lines from the newest log file.
|
|
|
|
|
|
|
|
+The `labels` and `env` options add additional attributes for use with logging drivers that accept them. Each of these options takes a comma-separated list of keys. If there is collision between `label` and `env` keys, the value of the `env` takes precedence.
|
|
|
|
+
|
|
|
|
+To use attributes, specify them when you start the Docker daemon.
|
|
|
|
+
|
|
|
|
+```
|
|
|
|
+docker daemon --log-driver=json-file --log-opt labels=foo --log-opt env=foo,fizz
|
|
|
|
+```
|
|
|
|
+
|
|
|
|
+Then, run a container and specify values for the `labels` or `env`. For example, you might use this:
|
|
|
|
+
|
|
|
|
+```
|
|
|
|
+docker run --label foo=bar -e fizz=buzz -d -P training/webapp python app.py
|
|
|
|
+````
|
|
|
|
+
|
|
|
|
+This adds additional fields depending on the driver, e.g. for
|
|
|
|
+`json-file` that looks like:
|
|
|
|
+
|
|
|
|
+ "attrs":{"fizz":"buzz","foo":"bar"}
|
|
|
|
+
|
|
|
|
+
|
|
## syslog options
|
|
## syslog options
|
|
|
|
|
|
The following logging options are supported for the `syslog` logging driver:
|
|
The following logging options are supported for the `syslog` logging driver:
|
|
@@ -100,6 +123,8 @@ The GELF logging driver supports the following options:
|
|
|
|
|
|
--log-opt gelf-address=udp://host:port
|
|
--log-opt gelf-address=udp://host:port
|
|
--log-opt tag="database"
|
|
--log-opt tag="database"
|
|
|
|
+ --log-opt labels=label1,label2
|
|
|
|
+ --log-opt env=env1,env2
|
|
|
|
|
|
The `gelf-address` option specifies the remote GELF server address that the
|
|
The `gelf-address` option specifies the remote GELF server address that the
|
|
driver connects to. Currently, only `udp` is supported as the transport and you must
|
|
driver connects to. Currently, only `udp` is supported as the transport and you must
|
|
@@ -112,6 +137,15 @@ By default, Docker uses the first 12 characters of the container ID to tag log m
|
|
Refer to the [log tag option documentation](log_tags.md) for customizing
|
|
Refer to the [log tag option documentation](log_tags.md) for customizing
|
|
the log tag format.
|
|
the log tag format.
|
|
|
|
|
|
|
|
+The `labels` and `env` options are supported by the gelf logging
|
|
|
|
+driver. It adds additional key on the `extra` fields, prefixed by an
|
|
|
|
+underscore (`_`).
|
|
|
|
+
|
|
|
|
+ // […]
|
|
|
|
+ "_foo": "bar",
|
|
|
|
+ "_fizz": "buzz",
|
|
|
|
+ // […]
|
|
|
|
+
|
|
|
|
|
|
## fluentd options
|
|
## fluentd options
|
|
|
|
|
|
@@ -128,6 +162,7 @@ If container cannot connect to the Fluentd daemon on the specified address,
|
|
the container stops immediately. For detailed information on working with this
|
|
the container stops immediately. For detailed information on working with this
|
|
logging driver, see [the fluentd logging driver](fluentd.md)
|
|
logging driver, see [the fluentd logging driver](fluentd.md)
|
|
|
|
|
|
|
|
+
|
|
## Specify Amazon CloudWatch Logs options
|
|
## Specify Amazon CloudWatch Logs options
|
|
|
|
|
|
The Amazon CloudWatch Logs logging driver supports the following options:
|
|
The Amazon CloudWatch Logs logging driver supports the following options:
|