Browse code

Merge pull request #23165 from thaJeztah/update-logging-code-hints

cleanup logging driver documentation
(cherry picked from commit 8d75709f90ba9926d41cd7b91bb316e336af8f8c)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2016/06/02 00:55:24
Showing 7 changed files
... ...
@@ -5,7 +5,6 @@ description = "Describes how to use the etwlogs logging driver."
5 5
 keywords = ["ETW, docker, logging, driver"]
6 6
 [menu.main]
7 7
 parent = "smn_logging" 
8
-weight=2
9 8
 +++
10 9
 <![end-metadata]-->
11 10
 
... ...
@@ -6,7 +6,6 @@ description = "Describes how to use the fluentd logging driver."
6 6
 keywords = ["Fluentd, docker, logging, driver"]
7 7
 [menu.main]
8 8
 parent = "smn_logging"
9
-weight=2
10 9
 +++
11 10
 <![end-metadata]-->
12 11
 
... ...
@@ -5,7 +5,6 @@ description = "Describes how to use the Google Cloud Logging driver."
5 5
 keywords = ["gcplogs, google, docker, logging, driver"]
6 6
 [menu.main]
7 7
 parent = "smn_logging"
8
-weight = 2
9 8
 +++
10 9
 <![end-metadata]-->
11 10
 
... ...
@@ -1,12 +1,11 @@
1 1
 <!--[metadata]>
2 2
 +++
3 3
 aliases = ["/engine/reference/logging/journald/"]
4
-title = "journald logging driver"
4
+title = "Journald logging driver"
5 5
 description = "Describes how to use the fluentd logging driver."
6
-keywords = ["Fluentd, docker, logging, driver"]
6
+keywords = ["Journald, docker, logging, driver"]
7 7
 [menu.main]
8 8
 parent = "smn_logging"
9
-weight = 2
10 9
 +++
11 10
 <![end-metadata]-->
12 11
 
... ...
@@ -6,7 +6,7 @@ description = "Describes how to format tags for."
6 6
 keywords = ["docker, logging, driver, syslog, Fluentd, gelf, journald"]
7 7
 [menu.main]
8 8
 parent = "smn_logging"
9
-weight = 1
9
+weight = -1
10 10
 +++
11 11
 <![end-metadata]-->
12 12
 
... ...
@@ -6,7 +6,7 @@ description = "Configure logging driver."
6 6
 keywords = ["docker, logging, driver, Fluentd"]
7 7
 [menu.main]
8 8
 parent = "smn_logging"
9
-weight=-1
9
+weight=-99
10 10
 +++
11 11
 <![end-metadata]-->
12 12
 
... ...
@@ -15,10 +15,13 @@ weight=-1
15 15
 
16 16
 The container can have a different logging driver than the Docker daemon. Use
17 17
 the `--log-driver=VALUE` with the `docker run` command to configure the
18
-container's logging driver. The following options are supported:
18
+container's logging driver. If the `--log-driver` option is not set, docker
19
+uses the default (`json-file`) logging driver. The following options are
20
+supported:
19 21
 
20
-| `none`      | Disables any logging for the container. `docker logs` won't be available with this driver.                                    |
22
+| Driver      | Description                                                                                                                   |
21 23
 |-------------|-------------------------------------------------------------------------------------------------------------------------------|
24
+| `none`      | Disables any logging for the container. `docker logs` won't be available with this driver.                                    |
22 25
 | `json-file` | Default logging driver for Docker. Writes JSON messages to file.                                                              |
23 26
 | `syslog`    | Syslog logging driver for Docker. Writes log messages to syslog.                                                              |
24 27
 | `journald`  | Journald logging driver for Docker. Writes log messages to `journald`.                                                        |
... ...
@@ -32,40 +35,58 @@ container's logging driver. The following options are supported:
32 32
 The `docker logs`command is available only for the `json-file` and `journald`
33 33
 logging drivers.
34 34
 
35
-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.
35
+The `labels` and `env` options add additional attributes for use with logging
36
+drivers that accept them. Each option takes a comma-separated list of keys. If
37
+there is collision between `label` and `env` keys, the value of the `env` takes
38
+precedence.
36 39
 
37
-To use attributes, specify them when you start the Docker daemon.
40
+To use attributes, specify them when you start the Docker daemon. For example,
41
+to manually start the daemon with the `json-file` driver, and include additional
42
+attributes in the output, run the following command:
38 43
 
39
-```
40
-docker daemon --log-driver=json-file --log-opt labels=foo --log-opt env=foo,fizz
44
+```bash
45
+$ docker daemon \
46
+    --log-driver=json-file \
47
+    --log-opt labels=foo \
48
+    --log-opt env=foo,fizz
41 49
 ```
42 50
 
43
-Then, run a container and specify values for the `labels` or `env`.  For example, you might use this:
51
+Then, run a container and specify values for the `labels` or `env`. For
52
+example, you might use this:
44 53
 
45
-```
46
-docker run --label foo=bar -e fizz=buzz -d -P training/webapp python app.py
54
+```bash
55
+$ docker run -dit --label foo=bar -e fizz=buzz alpine sh
47 56
 ```
48 57
 
49 58
 This adds additional fields to the log depending on the driver, e.g. for
50 59
 `json-file` that looks like:
51 60
 
52
-    "attrs":{"fizz":"buzz","foo":"bar"}
61
+```json
62
+"attrs":{"fizz":"buzz","foo":"bar"}
63
+```
53 64
 
54 65
 
55 66
 ## json-file options
56 67
 
57 68
 The following logging options are supported for the `json-file` logging driver:
58 69
 
59
-    --log-opt max-size=[0-9+][k|m|g]
60
-    --log-opt max-file=[0-9+]
61
-    --log-opt labels=label1,label2
62
-    --log-opt env=env1,env2
70
+```bash
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
+```
63 76
 
64
-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
+Logs that reach `max-size` are rolled over. You can set the size in
78
+kilobytes(k), megabytes(m), or gigabytes(g). eg `--log-opt max-size=50m`. If
79
+`max-size` is not set, then logs are not rolled over.
65 80
 
66
-`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.
81
+`max-file` specifies the maximum number of files that a log is rolled over
82
+before being discarded. eg `--log-opt max-file=100`. If `max-size` is not set,
83
+then `max-file` is not honored.
67 84
 
68
-If `max-size` and `max-file` are set, `docker logs` only returns the log lines from the newest log file.
85
+If `max-size` and `max-file` are set, `docker logs` only returns the log lines
86
+from the newest log file.
69 87
 
70 88
 
71 89
 ## syslog options
... ...
@@ -82,17 +103,20 @@ The following logging options are supported for the `syslog` logging driver:
82 82
     --log-opt tag="mailer"
83 83
     --log-opt syslog-format=[rfc5424|rfc3164] 
84 84
 
85
-`syslog-address` specifies the remote syslog server address where the driver connects to.
86
-If not specified it defaults to the local unix socket of the running system.
87
-If transport is either `tcp` or `udp` and `port` is not specified it defaults to `514`
88
-The following example shows how to have the `syslog` driver connect to a `syslog`
89
-remote server at `192.168.0.42` on port `123`
85
+`syslog-address` specifies the remote syslog server address where the driver
86
+connects to. If not specified it defaults to the local unix socket of the
87
+running system. If transport is either `tcp` or `udp` and `port` is not
88
+specified it defaults to `514` The following example shows how to have the
89
+`syslog` driver connect to a `syslog` remote server at `192.168.0.42` on port
90
+`123`
90 91
 
91
-    $ docker run --log-driver=syslog --log-opt syslog-address=tcp://192.168.0.42:123
92
+```bash
93
+$ docker run --log-driver=syslog --log-opt syslog-address=tcp://192.168.0.42:123
94
+```
92 95
 
93
-The `syslog-facility` option configures the syslog facility. By default, the system uses the
94
-`daemon` value. To override this behavior, you can provide an integer of 0 to 23 or any of
95
-the following named facilities:
96
+The `syslog-facility` option configures the syslog facility. By default, the
97
+system uses the `daemon` value. To override this behavior, you can provide an
98
+integer of 0 to 23 or any of the following named facilities:
96 99
 
97 100
 * `kern`
98 101
 * `user`
... ...
@@ -116,17 +140,18 @@ the following named facilities:
116 116
 * `local7`
117 117
 
118 118
 `syslog-tls-ca-cert` specifies the absolute path to the trust certificates
119
-signed by the CA. This option is ignored if the address protocol is not `tcp+tls`.
119
+signed by the CA. This option is ignored if the address protocol is not
120
+`tcp+tls`.
120 121
 
121
-`syslog-tls-cert` specifies the absolute path to the TLS certificate file.
122
-This option is ignored if the address protocol is not `tcp+tls`.
122
+`syslog-tls-cert` specifies the absolute path to the TLS certificate file. This
123
+option is ignored if the address protocol is not `tcp+tls`.
123 124
 
124
-`syslog-tls-key` specifies the absolute path to the TLS key file.
125
-This option is ignored if the address protocol is not `tcp+tls`.
125
+`syslog-tls-key` specifies the absolute path to the TLS key file. This option
126
+is ignored if the address protocol is not `tcp+tls`.
126 127
 
127
-`syslog-tls-skip-verify` configures the TLS verification.
128
-This verification is enabled by default, but it can be overriden by setting
129
-this option to `true`. This option is ignored if the address protocol is not `tcp+tls`.
128
+`syslog-tls-skip-verify` configures the TLS verification. This verification is
129
+enabled by default, but it can be overriden by setting this option to `true`.
130
+This option is ignored if the address protocol is not `tcp+tls`.
130 131
 
131 132
 By default, Docker uses the first 12 characters of the container ID to tag log messages.
132 133
 Refer to the [log tag option documentation](log_tags.md) for customizing
... ...
@@ -137,34 +162,40 @@ If not specified it defaults to the local unix syslog format without hostname sp
137 137
 Specify rfc3164 to perform logging in RFC-3164 compatible format. Specify rfc5424 to perform 
138 138
 logging in RFC-5424 compatible format
139 139
 
140
-
141 140
 ## journald options
142 141
 
143
-The `journald` logging driver stores the container id in the journal's `CONTAINER_ID` field. For detailed information on
144
-working with this logging driver, see [the journald logging driver](journald.md)
145
-reference documentation.
142
+The `journald` logging driver stores the container id in the journal's
143
+`CONTAINER_ID` field. For detailed information on working with this logging
144
+driver, see [the journald logging driver](journald.md) reference documentation.
146 145
 
147
-## gelf options
146
+## GELF options
148 147
 
149 148
 The GELF logging driver supports the following options:
150 149
 
151
-    --log-opt gelf-address=udp://host:port
152
-    --log-opt tag="database"
153
-    --log-opt labels=label1,label2
154
-    --log-opt env=env1,env2
155
-    --log-opt gelf-compression-type=gzip
156
-    --log-opt gelf-compression-level=1
150
+```bash
151
+--log-opt gelf-address=udp://host:port
152
+--log-opt tag="database"
153
+--log-opt labels=label1,label2
154
+--log-opt env=env1,env2
155
+--log-opt gelf-compression-type=gzip
156
+--log-opt gelf-compression-level=1
157
+```
157 158
 
158 159
 The `gelf-address` option specifies the remote GELF server address that the
159
-driver connects to. Currently, only `udp` is supported as the transport and you must
160
-specify a `port` value. The following example shows how to connect the `gelf`
161
-driver to a GELF remote server at `192.168.0.42` on port `12201`
160
+driver connects to. Currently, only `udp` is supported as the transport and you
161
+must specify a `port` value. The following example shows how to connect the
162
+`gelf` driver to a GELF remote server at `192.168.0.42` on port `12201`
163
+
164
+```bash
165
+$ docker run -dit \
166
+    --log-driver=gelf \
167
+    --log-opt gelf-address=udp://192.168.0.42:12201 \
168
+    alpine sh
169
+```
162 170
 
163
-    $ docker run --log-driver=gelf --log-opt gelf-address=udp://192.168.0.42:12201
164
-
165
-By default, Docker uses the first 12 characters of the container ID to tag log messages.
166
-Refer to the [log tag option documentation](log_tags.md) for customizing
167
-the log tag format.
171
+By default, Docker uses the first 12 characters of the container ID to tag log
172
+messages. Refer to the [log tag option documentation](log_tags.md) for
173
+customizing the log tag format.
168 174
 
169 175
 The `labels` and `env` options are supported by the gelf logging
170 176
 driver. It adds additional key on the `extra` fields, prefixed by an
... ...
@@ -179,14 +210,15 @@ The `gelf-compression-type` option can be used to change how the GELF driver
179 179
 compresses each log message. The accepted values are `gzip`, `zlib` and `none`.
180 180
 `gzip` is chosen by default.
181 181
 
182
-The `gelf-compression-level` option can be used to change the level of compresssion
183
-when `gzip` or `zlib` is selected as `gelf-compression-type`. Accepted value
184
-must be from from -1 to 9 (BestCompression). Higher levels typically
185
-run slower but compress more. Default value is 1 (BestSpeed).
182
+The `gelf-compression-level` option can be used to change the level of
183
+compresssion when `gzip` or `zlib` is selected as `gelf-compression-type`.
184
+Accepted value must be from from -1 to 9 (BestCompression). Higher levels
185
+typically run slower but compress more. Default value is 1 (BestSpeed).
186 186
 
187
-## fluentd options
187
+## Fluentd options
188 188
 
189
-You can use the `--log-opt NAME=VALUE` flag to specify these additional Fluentd logging driver options.
189
+You can use the `--log-opt NAME=VALUE` flag to specify these additional Fluentd
190
+logging driver options.
190 191
 
191 192
  - `fluentd-address`: specify `host:port` to connect [localhost:24224]
192 193
  - `tag`: specify tag for `fluentd` message
... ...
@@ -197,7 +229,13 @@ You can use the `--log-opt NAME=VALUE` flag to specify these additional Fluentd
197 197
 
198 198
 For example, to specify both additional options:
199 199
 
200
-`docker run --log-driver=fluentd --log-opt fluentd-address=localhost:24224 --log-opt tag=docker.{{.Name}}`
200
+```bash
201
+$ docker run -dit \
202
+    --log-driver=fluentd \
203
+    --log-opt fluentd-address=localhost:24224 \
204
+    --log-opt tag="docker.{{.Name}}" \
205
+    alpine sh
206
+```
201 207
 
202 208
 If container cannot connect to the Fluentd daemon on the specified address and
203 209
 `fluentd-async-connect` is not enabled, the container stops immediately.
... ...
@@ -205,42 +243,51 @@ For detailed information on working with this logging driver,
205 205
 see [the fluentd logging driver](fluentd.md)
206 206
 
207 207
 
208
-## Specify Amazon CloudWatch Logs options
208
+## Amazon CloudWatch Logs options
209 209
 
210 210
 The Amazon CloudWatch Logs logging driver supports the following options:
211 211
 
212
-    --log-opt awslogs-region=<aws_region>
213
-    --log-opt awslogs-group=<log_group_name>
214
-    --log-opt awslogs-stream=<log_stream_name>
215
-
212
+```bash
213
+--log-opt awslogs-region=<aws_region>
214
+--log-opt awslogs-group=<log_group_name>
215
+--log-opt awslogs-stream=<log_stream_name>
216
+```
216 217
 
217
-For detailed information on working with this logging driver, see [the awslogs logging driver](awslogs.md) reference documentation.
218
+For detailed information on working with this logging driver, see [the awslogs
219
+logging driver](awslogs.md) reference documentation.
218 220
 
219 221
 ## Splunk options
220 222
 
221 223
 The Splunk logging driver requires the following options:
222 224
 
223
-    --log-opt splunk-token=<splunk_http_event_collector_token>
224
-    --log-opt splunk-url=https://your_splunk_instance:8088
225
+```bash
226
+--log-opt splunk-token=<splunk_http_event_collector_token>
227
+--log-opt splunk-url=https://your_splunk_instance:8088
228
+```
225 229
 
226
-For detailed information about working with this logging driver, see the [Splunk logging driver](splunk.md)
227
-reference documentation.
230
+For detailed information about working with this logging driver, see the
231
+[Splunk logging driver](splunk.md) reference documentation.
228 232
 
229 233
 ## ETW logging driver options
230 234
 
231
-The etwlogs logging driver does not require any options to be specified. This logging driver will forward each log message
232
-as an ETW event. An ETW listener can then be created to listen for these events. 
235
+The etwlogs logging driver does not require any options to be specified. This
236
+logging driver forwards each log message as an ETW event. An ETW listener
237
+can then be created to listen for these events.
233 238
 
234
-For detailed information on working with this logging driver, see [the ETW logging driver](etwlogs.md) reference documentation.
239
+The ETW logging driver is only available on Windows. For detailed information
240
+on working with this logging driver, see [the ETW logging driver](etwlogs.md)
241
+reference documentation.
235 242
 
236
-## Google Cloud Logging
243
+## Google Cloud Logging options
237 244
 
238 245
 The Google Cloud Logging driver supports the following options:
239 246
 
240
-    --log-opt gcp-project=<gcp_projext>
241
-    --log-opt labels=<label1>,<label2>
242
-    --log-opt env=<envvar1>,<envvar2>
243
-    --log-opt log-cmd=true
247
+```bash
248
+--log-opt gcp-project=<gcp_projext>
249
+--log-opt labels=<label1>,<label2>
250
+--log-opt env=<envvar1>,<envvar2>
251
+--log-opt log-cmd=true
252
+```
244 253
 
245
-For detailed information about working with this logging driver, see the [Google Cloud Logging driver](gcplogs.md).
246
-reference documentation.
254
+For detailed information about working with this logging driver, see the
255
+[Google Cloud Logging driver](gcplogs.md). reference documentation.
... ...
@@ -6,7 +6,6 @@ description = "Describes how to use the Splunk logging driver."
6 6
 keywords = ["splunk, docker, logging, driver"]
7 7
 [menu.main]
8 8
 parent = "smn_logging"
9
-weight = 2
10 9
 +++
11 10
 <![end-metadata]-->
12 11