Browse code

cleanup logging driver documentation

This does a minor cleanup of the logging driver
documentation;

- Add a table-header to the driver-options
table.
- Add language hints to code-blocks to
prevent incorrect highlighting
- Wrap some code examples so that they
fit in the default layout
- Wrap text to 80-chars
- Fix ordering in menu
- Some minor rewording

We should still create separate pages
for all available drivers (for example,
json-file, syslog, and GELF don't have
their own configuration page)

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

Sebastiaan van Stijn authored on 2016/06/01 20:18:25
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,70 +35,93 @@ 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
72 90
 
73 91
 The following logging options are supported for the `syslog` logging driver:
74 92
 
75
-    --log-opt syslog-address=[tcp|udp|tcp+tls]://host:port
76
-    --log-opt syslog-address=unix://path
77
-    --log-opt syslog-address=unixgram://path
78
-    --log-opt syslog-facility=daemon
79
-    --log-opt syslog-tls-ca-cert=/etc/ca-certificates/custom/ca.pem
80
-    --log-opt syslog-tls-cert=/etc/ca-certificates/custom/cert.pem
81
-    --log-opt syslog-tls-key=/etc/ca-certificates/custom/key.pem
82
-    --log-opt syslog-tls-skip-verify=true
83
-    --log-opt tag="mailer"
84
-    --log-opt syslog-format=[rfc5424|rfc5424micro|rfc3164]
85
-    --log-opt env=ENV1,ENV2,ENV3
86
-    --log-opt labels=label1,label2,label3
87
-
88
-`syslog-address` specifies the remote syslog server address where the driver connects to.
89
-If not specified it defaults to the local unix socket of the running system.
90
-If transport is either `tcp` or `udp` and `port` is not specified it defaults to `514`
91
-The following example shows how to have the `syslog` driver connect to a `syslog`
92
-remote server at `192.168.0.42` on port `123`
93
-
94
-    $ docker run --log-driver=syslog --log-opt syslog-address=tcp://192.168.0.42:123
95
-
96
-The `syslog-facility` option configures the syslog facility. By default, the system uses the
97
-`daemon` value. To override this behavior, you can provide an integer of 0 to 23 or any of
98
-the following named facilities:
93
+```bash
94
+--log-opt syslog-address=[tcp|udp|tcp+tls]://host:port
95
+--log-opt syslog-address=unix://path
96
+--log-opt syslog-address=unixgram://path
97
+--log-opt syslog-facility=daemon
98
+--log-opt syslog-tls-ca-cert=/etc/ca-certificates/custom/ca.pem
99
+--log-opt syslog-tls-cert=/etc/ca-certificates/custom/cert.pem
100
+--log-opt syslog-tls-key=/etc/ca-certificates/custom/key.pem
101
+--log-opt syslog-tls-skip-verify=true
102
+--log-opt tag="mailer"
103
+--log-opt syslog-format=[rfc5424|rfc5424micro|rfc3164]
104
+--log-opt env=ENV1,ENV2,ENV3
105
+--log-opt labels=label1,label2,label3
106
+```
107
+
108
+`syslog-address` specifies the remote syslog server address where the driver
109
+connects to. If not specified it defaults to the local unix socket of the
110
+running system. If transport is either `tcp` or `udp` and `port` is not
111
+specified it defaults to `514` The following example shows how to have the
112
+`syslog` driver connect to a `syslog` remote server at `192.168.0.42` on port
113
+`123`
114
+
115
+```bash
116
+$ docker run --log-driver=syslog --log-opt syslog-address=tcp://192.168.0.42:123
117
+```
118
+
119
+The `syslog-facility` option configures the syslog facility. By default, the
120
+system uses the `daemon` value. To override this behavior, you can provide an
121
+integer of 0 to 23 or any of the following named facilities:
99 122
 
100 123
 * `kern`
101 124
 * `user`
... ...
@@ -119,62 +145,71 @@ the following named facilities:
119 119
 * `local7`
120 120
 
121 121
 `syslog-tls-ca-cert` specifies the absolute path to the trust certificates
122
-signed by the CA. This option is ignored if the address protocol is not `tcp+tls`.
122
+signed by the CA. This option is ignored if the address protocol is not
123
+`tcp+tls`.
123 124
 
124
-`syslog-tls-cert` specifies the absolute path to the TLS certificate file.
125
-This option is ignored if the address protocol is not `tcp+tls`.
125
+`syslog-tls-cert` specifies the absolute path to the TLS certificate file. This
126
+option is ignored if the address protocol is not `tcp+tls`.
126 127
 
127
-`syslog-tls-key` specifies the absolute path to the TLS key file.
128
-This option is ignored if the address protocol is not `tcp+tls`.
128
+`syslog-tls-key` specifies the absolute path to the TLS key file. This option
129
+is ignored if the address protocol is not `tcp+tls`.
129 130
 
130
-`syslog-tls-skip-verify` configures the TLS verification.
131
-This verification is enabled by default, but it can be overriden by setting
132
-this option to `true`. This option is ignored if the address protocol is not `tcp+tls`.
131
+`syslog-tls-skip-verify` configures the TLS verification. This verification is
132
+enabled by default, but it can be overriden by setting this option to `true`.
133
+This option is ignored if the address protocol is not `tcp+tls`.
133 134
 
134
-`tag` configures a string that is appended to the APP-NAME in the syslog message.
135
-By default, Docker uses the first 12 characters of the container ID to tag log messages.
136
-Refer to the [log tag option documentation](log_tags.md) for customizing
137
-the log tag format.
135
+`tag` configures a string that is appended to the APP-NAME in the syslog
136
+message. By default, Docker uses the first 12 characters of the container ID to
137
+tag log messages. Refer to the [log tag option documentation](log_tags.md) for
138
+customizing the log tag format.
138 139
 
139
-`syslog-format` specifies syslog message format to use when logging.
140
-If not specified it defaults to the local unix syslog format without hostname specification.
141
-Specify rfc3164 to perform logging in RFC-3164 compatible format. Specify rfc5424 to perform 
142
-logging in RFC-5424 compatible format. Specify rfc5424micro to perform logging in RFC-5424
143
-compatible format with microsecond timestamp resolution.
140
+`syslog-format` specifies syslog message format to use when logging. If not
141
+specified it defaults to the local unix syslog format without hostname
142
+specification. Specify rfc3164 to perform logging in RFC-3164 compatible
143
+format. Specify rfc5424 to perform logging in RFC-5424 compatible format.
144
+Specify rfc5424micro to perform logging in RFC-5424 compatible format with
145
+microsecond timestamp resolution.
144 146
 
145
-`env` should be a comma-separated list of keys of environment variables. Used for
147
+`env` is a comma-separated list of keys of environment variables. Used for
146 148
 advanced [log tag options](log_tags.md).
147 149
 
148
-`labels` should be a comma-separated list of keys of labels. Used for advanced
149
-[log tag options](log_tags.md).
150
+`labels` is a comma-separated list of keys of labels. Used for advanced [log
151
+tag options](log_tags.md).
150 152
 
151 153
 ## journald options
152 154
 
153
-The `journald` logging driver stores the container id in the journal's `CONTAINER_ID` field. For detailed information on
154
-working with this logging driver, see [the journald logging driver](journald.md)
155
-reference documentation.
155
+The `journald` logging driver stores the container id in the journal's
156
+`CONTAINER_ID` field. For detailed information on working with this logging
157
+driver, see [the journald logging driver](journald.md) reference documentation.
156 158
 
157
-## gelf options
159
+## GELF options
158 160
 
159 161
 The GELF logging driver supports the following options:
160 162
 
161
-    --log-opt gelf-address=udp://host:port
162
-    --log-opt tag="database"
163
-    --log-opt labels=label1,label2
164
-    --log-opt env=env1,env2
165
-    --log-opt gelf-compression-type=gzip
166
-    --log-opt gelf-compression-level=1
163
+```bash
164
+--log-opt gelf-address=udp://host:port
165
+--log-opt tag="database"
166
+--log-opt labels=label1,label2
167
+--log-opt env=env1,env2
168
+--log-opt gelf-compression-type=gzip
169
+--log-opt gelf-compression-level=1
170
+```
167 171
 
168 172
 The `gelf-address` option specifies the remote GELF server address that the
169
-driver connects to. Currently, only `udp` is supported as the transport and you must
170
-specify a `port` value. The following example shows how to connect the `gelf`
171
-driver to a GELF remote server at `192.168.0.42` on port `12201`
172
-
173
-    $ docker run --log-driver=gelf --log-opt gelf-address=udp://192.168.0.42:12201
173
+driver connects to. Currently, only `udp` is supported as the transport and you
174
+must specify a `port` value. The following example shows how to connect the
175
+`gelf` driver to a GELF remote server at `192.168.0.42` on port `12201`
176
+
177
+```bash
178
+$ docker run -dit \
179
+    --log-driver=gelf \
180
+    --log-opt gelf-address=udp://192.168.0.42:12201 \
181
+    alpine sh
182
+```
174 183
 
175
-By default, Docker uses the first 12 characters of the container ID to tag log messages.
176
-Refer to the [log tag option documentation](log_tags.md) for customizing
177
-the log tag format.
184
+By default, Docker uses the first 12 characters of the container ID to tag log
185
+messages. Refer to the [log tag option documentation](log_tags.md) for
186
+customizing the log tag format.
178 187
 
179 188
 The `labels` and `env` options are supported by the gelf logging
180 189
 driver. It adds additional key on the `extra` fields, prefixed by an
... ...
@@ -189,14 +224,15 @@ The `gelf-compression-type` option can be used to change how the GELF driver
189 189
 compresses each log message. The accepted values are `gzip`, `zlib` and `none`.
190 190
 `gzip` is chosen by default.
191 191
 
192
-The `gelf-compression-level` option can be used to change the level of compresssion
193
-when `gzip` or `zlib` is selected as `gelf-compression-type`. Accepted value
194
-must be from from -1 to 9 (BestCompression). Higher levels typically
195
-run slower but compress more. Default value is 1 (BestSpeed).
192
+The `gelf-compression-level` option can be used to change the level of
193
+compresssion when `gzip` or `zlib` is selected as `gelf-compression-type`.
194
+Accepted value must be from from -1 to 9 (BestCompression). Higher levels
195
+typically run slower but compress more. Default value is 1 (BestSpeed).
196 196
 
197
-## fluentd options
197
+## Fluentd options
198 198
 
199
-You can use the `--log-opt NAME=VALUE` flag to specify these additional Fluentd logging driver options.
199
+You can use the `--log-opt NAME=VALUE` flag to specify these additional Fluentd
200
+logging driver options.
200 201
 
201 202
  - `fluentd-address`: specify `host:port` to connect [localhost:24224]
202 203
  - `tag`: specify tag for `fluentd` message
... ...
@@ -207,7 +243,13 @@ You can use the `--log-opt NAME=VALUE` flag to specify these additional Fluentd
207 207
 
208 208
 For example, to specify both additional options:
209 209
 
210
-`docker run --log-driver=fluentd --log-opt fluentd-address=localhost:24224 --log-opt tag=docker.{{.Name}}`
210
+```bash
211
+$ docker run -dit \
212
+    --log-driver=fluentd \
213
+    --log-opt fluentd-address=localhost:24224 \
214
+    --log-opt tag="docker.{{.Name}}" \
215
+    alpine sh
216
+```
211 217
 
212 218
 If container cannot connect to the Fluentd daemon on the specified address and
213 219
 `fluentd-async-connect` is not enabled, the container stops immediately.
... ...
@@ -215,42 +257,51 @@ For detailed information on working with this logging driver,
215 215
 see [the fluentd logging driver](fluentd.md)
216 216
 
217 217
 
218
-## Specify Amazon CloudWatch Logs options
218
+## Amazon CloudWatch Logs options
219 219
 
220 220
 The Amazon CloudWatch Logs logging driver supports the following options:
221 221
 
222
-    --log-opt awslogs-region=<aws_region>
223
-    --log-opt awslogs-group=<log_group_name>
224
-    --log-opt awslogs-stream=<log_stream_name>
225
-
222
+```bash
223
+--log-opt awslogs-region=<aws_region>
224
+--log-opt awslogs-group=<log_group_name>
225
+--log-opt awslogs-stream=<log_stream_name>
226
+```
226 227
 
227
-For detailed information on working with this logging driver, see [the awslogs logging driver](awslogs.md) reference documentation.
228
+For detailed information on working with this logging driver, see [the awslogs
229
+logging driver](awslogs.md) reference documentation.
228 230
 
229 231
 ## Splunk options
230 232
 
231 233
 The Splunk logging driver requires the following options:
232 234
 
233
-    --log-opt splunk-token=<splunk_http_event_collector_token>
234
-    --log-opt splunk-url=https://your_splunk_instance:8088
235
+```bash
236
+--log-opt splunk-token=<splunk_http_event_collector_token>
237
+--log-opt splunk-url=https://your_splunk_instance:8088
238
+```
235 239
 
236
-For detailed information about working with this logging driver, see the [Splunk logging driver](splunk.md)
237
-reference documentation.
240
+For detailed information about working with this logging driver, see the
241
+[Splunk logging driver](splunk.md) reference documentation.
238 242
 
239 243
 ## ETW logging driver options
240 244
 
241
-The etwlogs logging driver does not require any options to be specified. This logging driver will forward each log message
242
-as an ETW event. An ETW listener can then be created to listen for these events. 
245
+The etwlogs logging driver does not require any options to be specified. This
246
+logging driver forwards each log message as an ETW event. An ETW listener
247
+can then be created to listen for these events.
243 248
 
244
-For detailed information on working with this logging driver, see [the ETW logging driver](etwlogs.md) reference documentation.
249
+The ETW logging driver is only available on Windows. For detailed information
250
+on working with this logging driver, see [the ETW logging driver](etwlogs.md)
251
+reference documentation.
245 252
 
246
-## Google Cloud Logging
253
+## Google Cloud Logging options
247 254
 
248 255
 The Google Cloud Logging driver supports the following options:
249 256
 
250
-    --log-opt gcp-project=<gcp_projext>
251
-    --log-opt labels=<label1>,<label2>
252
-    --log-opt env=<envvar1>,<envvar2>
253
-    --log-opt log-cmd=true
257
+```bash
258
+--log-opt gcp-project=<gcp_projext>
259
+--log-opt labels=<label1>,<label2>
260
+--log-opt env=<envvar1>,<envvar2>
261
+--log-opt log-cmd=true
262
+```
254 263
 
255
-For detailed information about working with this logging driver, see the [Google Cloud Logging driver](gcplogs.md).
256
-reference documentation.
264
+For detailed information about working with this logging driver, see the
265
+[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