You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/sources/send-data/docker-driver/_index.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -79,7 +79,7 @@ docker plugin rm loki
79
79
80
80
The driver keeps all logs in memory and will drop log entries if Loki is not reachable and if the quantity of `max_retries` has been exceeded. To avoid the dropping of log entries, setting `max_retries` to zero allows unlimited retries; the driver will continue trying forever until Loki is again reachable. Trying forever may have undesired consequences, because the Docker daemon will wait for the Loki driver to process all logs of a container, until the container is removed. Thus, the Docker daemon might wait forever if the container is stuck.
81
81
82
-
The wait time can be lowered by setting `loki-retries=2`, `loki-max-backoff=800ms`, `loki-timeout=1s` and `keep-file=true`. This way the daemon will be locked only for a short time and the logs will be persisted locally when the Loki client is unable to re-connect.
82
+
The wait time can be lowered by setting `loki-retries=2`, `loki-max-backoff=800ms`, `loki-timeout=1s` and `keep-file=true`. This way the daemon will be locked only for a short time and the JSON log files will be retained on disk when the Loki client is unable to re-connect.
83
83
84
84
Also you can use non-blocking mode by setting `services.logger.logging.options.mode=non-blocking` in your `docker-compose` file. Non-blocking means that the process of writing logs to Loki will not block the main flow of an application or service if Loki is temporarily unavailable or unable to process log messages. In non-blocking mode, log messages will be buffered and sent to Loki asynchronously, which allows the main thread to continue working without delay. If Loki is unavailable, log messages will be stored in a buffer and sent when Loki becomes available again. However, this setting is useful to prevent blocking the main flow of an application or service due to logging issues, but it can also lead to loss of log messages if the buffer overflows or if Loki is unavailable for a long time.
Copy file name to clipboardExpand all lines: docs/sources/send-data/docker-driver/configuration.md
+13-3Lines changed: 13 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ The Loki logging driver still uses the json-log driver in combination with sendi
40
40
to keep the `docker logs` command working.
41
41
You can adjust file size and rotation using the respective log option `max-size` and `max-file`. Keep in mind that
42
42
default values for these options are not taken from json-log configuration.
43
-
You can deactivate this behavior by setting the log option `no-file` to true.
43
+
You can disable JSON log file creation by setting the log option `no-file` to `true`, but this also disables `docker logs` for the container.
44
44
{{< /admonition >}}
45
45
46
46
## Change the default logging driver
@@ -238,14 +238,24 @@ To specify additional logging driver options, you can use the --log-opt NAME=VAL
238
238
| `loki-tls-server-name` | No | | Name used to validate the server certificate. |
239
239
| `loki-tls-insecure-skip-verify` | No | `false`* | Allow to skip tls verification. |
240
240
| `loki-proxy-url` | No | | Proxy URL use to connect to Loki. |
241
-
| `no-file` | No | `false`* | Default is "false" and log files are created. Set to "true" to tell driver not to ever create log files on disk. However, this means you won't be able to use `docker logs` on the container anymore. Use this setting if you don't need to use `docker logs` or run with limited disk space. |
242
-
| `keep-file` | No | `false`* | Default is "false" and log files are removed once a container is stopped. Set to "true" to tell driver to keep json log files once a container is stopped. |
241
+
| `no-file` | No | `false`* | When `false` (default), the driver creates a local JSON log file for each container, which enables `docker logs`. Set to `true` to skip creating JSON log files entirely — no disk space is used for logs, but `docker logs` will not work for the container. |
242
+
| `keep-file` | No | `false`* | When `false` (default), the JSON log file for a container is deleted when the container stops. Set to `true` to retain the JSON log file after the container stops. Has no effect when `no-file=true`, because no JSON log file is created. |
243
243
| `max-size` | No | -1 | The maximum size of the log before it is rolled. A positive integer plus a modifier representing the unit of measure (k, m, or g). Defaults to -1 (unlimited). This is used by json-log required to keep the `docker log` command working. |
244
244
| `max-file` | No | 1 | The maximum number of log files that can be present. If rolling the logs creates excess files, the oldest file is removed. Only effective when max-size is also set. A positive integer. Defaults to 1. |
245
245
| `labels` | No | | Comma-separated list of keys of labels, which should be included in message, if these labels are specified for container. |
246
246
| `env` | No | | Comma-separated list of keys of environment variables to be included in message if they specified for a container. |
247
247
| `env-regex` | No | | A regular expression to match logging-related environment variables. Used for advanced log label options. If there is collision between the label and env keys, the value of the env takes precedence. Both options add additional fields to the labels of a logging message. |
248
248
249
+
### `no-file` and `keep-file` interactions
250
+
251
+
The `no-file` and `keep-file` options control whether JSON log files are created and how long they are kept:
0 commit comments