From a65416e7d9be8ad01685beaf008a1fd1397dd91c Mon Sep 17 00:00:00 2001 From: Fred Clausen <43556888+fredclausen@users.noreply.github.com> Date: Sun, 13 Aug 2023 14:15:36 -0600 Subject: [PATCH] readme updates, remove excess log elements --- README.md | 11 ++++++++--- src/index.ts | 6 ++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8dea0d4..db5b528 100644 --- a/README.md +++ b/README.md @@ -18,18 +18,23 @@ Monitor Hub is a simple docker container that enables you to view logs from all - TZ=${FEEDER_TZ} volumes: - /var/run/docker.sock:/var/run/docker.sock - + tmpfs: + - /run:exec,size=64M + - /var/log + - /tmp ``` Likely you will need to amend the port line if port `80` is in use on your host or in docker. ## Limitations and Future Improvements -Currently, the container will initially show only 10 lines of logs from each container. Once connected, new lines from the containers are appended and you can scroll through them. Loading the page took forever without this limitation with any number of containers that had been running. This will be improved in future versions. +***If you have a large stack of containers, OR you have containers that contain a significant number of log entries, the page will not be available until all log entries are processed. This may take a minute or two to accomplish*** + +Currently, the container will show up to 100 lines of logs (50 on page load) from each container. This is done to save infinite scrolling and bandwidth. This will be improved by adding a "load more" (or simililar idea) button in the future. The webpage is a bit basic. While this entire project doesn't need much complication, it's a bit basic for my liking. -***If you have a large stack of containers, OR you have containers that contain a significant number of log entries, the page will not be available until all log entries are processed. This may take a minute or two to accomplish*** +The webpage is unusable on mobile. This will be improved in future versions. The page does not auto-scroll to the bottom. This will be improved in future versions. diff --git a/src/index.ts b/src/index.ts index e7321c2..39313db 100644 --- a/src/index.ts +++ b/src/index.ts @@ -70,6 +70,11 @@ $((): void => { if (active_container == data.name) { $("#container-logs").append(generate_log_element(data.log)); + + // if there are more than 100 logs, remove the first one + while ($("#container-logs p").length > 100) { + $("#container-logs p").first().remove(); + } } }); @@ -104,6 +109,7 @@ window.show_logs = function (name: any) { }; function generate_log_element(log: any) { + // BE CAREFUL HERE. IF YOU CHANGE THE P TAG TO A DIFFERENT TAG, YOU MUST CHANGE THE REMOVE LOGS CODE IN THE NEW_LOG EVENT return `
${stripAnsi(log)}
`; }