Signed-off-by: Mary Anthony <mary@docker.com>
| ... | ... |
@@ -75,21 +75,8 @@ the log tag format. |
| 75 | 75 |
|
| 76 | 76 |
### labels and env |
| 77 | 77 |
|
| 78 |
-The `labels` and `env` options takes a comma-separated list of keys. If there is collision between `label` and `env` keys, the value of the `env` takes precedence. |
|
| 78 |
+The `labels` and `env` options each take a comma-separated list of keys. If there is collision between `label` and `env` keys, the value of the `env` takes precedence. Both options add additional fields to the extra attributes of a logging message. |
|
| 79 | 79 |
|
| 80 |
-To use attributes, specify them when you start the Docker daemon. |
|
| 81 |
- |
|
| 82 |
-``` |
|
| 83 |
-docker daemon --log-driver=fluentd --log-opt labels=foo --log-opt env=foo,fizz |
|
| 84 |
-``` |
|
| 85 |
- |
|
| 86 |
-Then, run a container and specify values for the `labels` or `env`. For example, you might use this: |
|
| 87 |
- |
|
| 88 |
-``` |
|
| 89 |
-docker run --label foo=bar -e fizz=buzz -d -P training/webapp python app.py |
|
| 90 |
-```` |
|
| 91 |
- |
|
| 92 |
-This adds additional fields to the extra attributes of a logging message. |
|
| 93 | 80 |
|
| 94 | 81 |
## Fluentd daemon management with Docker |
| 95 | 82 |
|
| ... | ... |
@@ -110,7 +97,7 @@ aggregate store. |
| 110 | 110 |
<source> |
| 111 | 111 |
@type forward |
| 112 | 112 |
</source> |
| 113 |
- |
|
| 113 |
+ |
|
| 114 | 114 |
<match docker.**> |
| 115 | 115 |
@type stdout |
| 116 | 116 |
</match> |
| ... | ... |
@@ -43,23 +43,7 @@ journald logging driver options. |
| 43 | 43 |
|
| 44 | 44 |
### labels and env |
| 45 | 45 |
|
| 46 |
-The `labels` and `env` options takes a comma-separated list of keys. If there is collision between `label` and `env` keys, the value of the `env` takes precedence. |
|
| 47 |
- |
|
| 48 |
-To use attributes, specify them when you start the Docker daemon. |
|
| 49 |
- |
|
| 50 |
-``` |
|
| 51 |
-docker daemon --log-driver=journald --log-opt labels=foo --log-opt env=foo,fizz |
|
| 52 |
-``` |
|
| 53 |
- |
|
| 54 |
-Then, run a container and specify values for the `labels` or `env`. For example, you might use this: |
|
| 55 |
- |
|
| 56 |
-``` |
|
| 57 |
-docker run --label foo=bar -e fizz=buzz -d -P training/webapp python app.py |
|
| 58 |
-```` |
|
| 59 |
- |
|
| 60 |
-This adds additional metadata in the journal with each message, one |
|
| 61 |
-for each key that matches. |
|
| 62 |
- |
|
| 46 |
+The `labels` and `env` options each take a comma-separated list of keys. If there is collision between `label` and `env` keys, the value of the `env` takes precedence. Both options add additional metadata in the journal with each message. |
|
| 63 | 47 |
|
| 64 | 48 |
## Note regarding container names |
| 65 | 49 |
|
| ... | ... |
@@ -99,4 +83,3 @@ logs: |
| 99 | 99 |
|
| 100 | 100 |
for msg in reader: |
| 101 | 101 |
print '{CONTAINER_ID_FULL}: {MESSAGE}'.format(**msg)
|
| 102 |
- |
| ... | ... |
@@ -27,24 +27,7 @@ container's logging driver. The following options are supported: |
| 27 | 27 |
|
| 28 | 28 |
The `docker logs`command is available only for the `json-file` logging driver. |
| 29 | 29 |
|
| 30 |
- |
|
| 31 |
-## json-file options |
|
| 32 |
- |
|
| 33 |
-The following logging options are supported for the `json-file` logging driver: |
|
| 34 |
- |
|
| 35 |
- --log-opt max-size=[0-9+][k|m|g] |
|
| 36 |
- --log-opt max-file=[0-9+] |
|
| 37 |
- --log-opt labels=label1,label2 |
|
| 38 |
- --log-opt env=env1,env2 |
|
| 39 |
- |
|
| 40 |
-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 |
- |
|
| 42 |
- |
|
| 43 |
-`max-file` specifies the maximum number of files that a log is rolled over before being discarded. eg `--log-opt max-file=100`. If `max-size` is not set, then `max-file` is not honored. |
|
| 44 |
- |
|
| 45 |
-If `max-size` and `max-file` are set, `docker logs` only returns the log lines from the newest log file. |
|
| 46 |
- |
|
| 47 |
-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. |
|
| 30 |
+The `labels` and `env` options add additional attributes for use with logging drivers that accept them. Each option takes a comma-separated list of keys. If there is collision between `label` and `env` keys, the value of the `env` takes precedence. |
|
| 48 | 31 |
|
| 49 | 32 |
To use attributes, specify them when you start the Docker daemon. |
| 50 | 33 |
|
| ... | ... |
@@ -58,12 +41,28 @@ Then, run a container and specify values for the `labels` or `env`. For example |
| 58 | 58 |
docker run --label foo=bar -e fizz=buzz -d -P training/webapp python app.py |
| 59 | 59 |
```` |
| 60 | 60 |
|
| 61 |
-This adds additional fields depending on the driver, e.g. for |
|
| 61 |
+This adds additional fields to the log depending on the driver, e.g. for |
|
| 62 | 62 |
`json-file` that looks like: |
| 63 | 63 |
|
| 64 | 64 |
"attrs":{"fizz":"buzz","foo":"bar"}
|
| 65 | 65 |
|
| 66 | 66 |
|
| 67 |
+## json-file options |
|
| 68 |
+ |
|
| 69 |
+The following logging options are supported for the `json-file` logging driver: |
|
| 70 |
+ |
|
| 71 |
+ --log-opt max-size=[0-9+][k|m|g] |
|
| 72 |
+ --log-opt max-file=[0-9+] |
|
| 73 |
+ --log-opt labels=label1,label2 |
|
| 74 |
+ --log-opt env=env1,env2 |
|
| 75 |
+ |
|
| 76 |
+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. |
|
| 77 |
+ |
|
| 78 |
+`max-file` specifies the maximum number of files that a log is rolled over before being discarded. eg `--log-opt max-file=100`. If `max-size` is not set, then `max-file` is not honored. |
|
| 79 |
+ |
|
| 80 |
+If `max-size` and `max-file` are set, `docker logs` only returns the log lines from the newest log file. |
|
| 81 |
+ |
|
| 82 |
+ |
|
| 67 | 83 |
## syslog options |
| 68 | 84 |
|
| 69 | 85 |
The following logging options are supported for the `syslog` logging driver: |