Browse Source

Merge pull request #16985 from moxiegirl/carry-dup-text-16961

Centralize discussion of behavior label and env.
Sebastiaan van Stijn 9 years ago
parent
commit
e766a3505c

+ 2 - 15
docs/reference/logging/fluentd.md

@@ -75,21 +75,8 @@ the log tag format.
 
 
 ### labels and env
 ### labels and env
 
 
-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.
+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.
 
 
-To use attributes, specify them when you start the Docker daemon.
-
-```
-docker daemon --log-driver=fluentd --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 to the extra attributes of a logging message.
 
 
 ## Fluentd daemon management with Docker
 ## Fluentd daemon management with Docker
 
 
@@ -110,7 +97,7 @@ aggregate store.
         <source>
         <source>
           @type forward
           @type forward
         </source>
         </source>
-    
+
         <match docker.**>
         <match docker.**>
           @type stdout
           @type stdout
         </match>
         </match>

+ 1 - 18
docs/reference/logging/journald.md

@@ -43,23 +43,7 @@ journald logging driver options.
 
 
 ### labels and env
 ### labels and env
 
 
-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.
-
-To use attributes, specify them when you start the Docker daemon.
-
-```
-docker daemon --log-driver=journald --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 metadata in the journal with each message, one
-for each key that matches.
-
+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.
 
 
 ## Note regarding container names
 ## Note regarding container names
 
 
@@ -99,4 +83,3 @@ logs:
 
 
     for msg in reader:
     for msg in reader:
       print '{CONTAINER_ID_FULL}: {MESSAGE}'.format(**msg)
       print '{CONTAINER_ID_FULL}: {MESSAGE}'.format(**msg)
-

+ 18 - 19
docs/reference/logging/overview.md

@@ -27,24 +27,7 @@ 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
-
-The following logging options are supported for the `json-file` logging driver:
-
-    --log-opt max-size=[0-9+][k|m|g]
-    --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.
-
-
-`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.
-
-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.
+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.
 
 
 To use attributes, specify them when you start the Docker daemon.
 To use attributes, specify them when you start the Docker daemon.
 
 
@@ -58,12 +41,28 @@ Then, run a container and specify values for the `labels` or `env`.  For example
 docker run --label foo=bar -e fizz=buzz -d -P training/webapp python app.py
 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
+This adds additional fields to the log depending on the driver, e.g. for
 `json-file` that looks like:
 `json-file` that looks like:
 
 
     "attrs":{"fizz":"buzz","foo":"bar"}
     "attrs":{"fizz":"buzz","foo":"bar"}
 
 
 
 
+## json-file options
+
+The following logging options are supported for the `json-file` logging driver:
+
+    --log-opt max-size=[0-9+][k|m|g]
+    --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.
+
+`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.
+
+If `max-size` and `max-file` are set, `docker logs` only returns the log lines from the newest log file.
+
+
 ## 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: