From 02a40fdd8e86cd9e022c58388c2513557d6c7dd7 Mon Sep 17 00:00:00 2001 From: EDIflyer Date: Fri, 17 Nov 2023 20:48:43 +0000 Subject: [PATCH] docs: Add docker-compose.yml option (#2511) --- docs/guide/log-files-on-disk.md | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/docs/guide/log-files-on-disk.md b/docs/guide/log-files-on-disk.md index dfc8d2ae..a6121ae2 100644 --- a/docs/guide/log-files-on-disk.md +++ b/docs/guide/log-files-on-disk.md @@ -12,10 +12,32 @@ However, there are workarounds to be able to still access files using mounts. ## Mounting Local Log Files with Alpine -Dozzle reads any output stream. This can be used in combination with alpine to `tail` a mounted file. An example of this is: +Dozzle reads any output stream. This can be used in combination with alpine to `tail` a mounted file. An example of this is as follows: + +::: code-group ```sh docker run -v /var/log/system.log:/var/log/test.log alpine tail -f /var/log/test.log ``` +```yaml [docker-compose.yml] +version: "3" +services: + dozzle-from-file: + container_name: dozzle-from-file + image: alpine + volumes: + - /var/log/system.log:/var/log/stream.log + command: + - tail + - -f + - /var/log/stream.log + network_mode: none + restart: unless-stopped +``` + +::: + In the above example `/var/log/system.log` is mounted from the host and used with `tail -f` to follow the file. `tail` is smart to follow log rotations. During my testing, using alpine only uses about `300KB` of memory. + +The second tab shows a `docker-compose` file which is useful if you want the log stream to survive server reboot.