From 2fc29ff7c81e2bbdd7595bc97fc51228506fa17e Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Tue, 9 Dec 2025 17:06:11 -0600 Subject: [PATCH 1/3] feat(logging): exclude Dashboard requests from access logs processing - Updated the log processing functions to filter out requests that start with "/dashboard". - Enhanced the monitoring configuration to also exclude Dashboard requests alongside the Dokploy service app. --- packages/server/src/utils/access-log/utils.ts | 8 ++++++++ packages/server/src/utils/traefik/application.ts | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/server/src/utils/access-log/utils.ts b/packages/server/src/utils/access-log/utils.ts index 9e9070b69..b9b4fd879 100644 --- a/packages/server/src/utils/access-log/utils.ts +++ b/packages/server/src/utils/access-log/utils.ts @@ -27,6 +27,10 @@ export function processLogs( if (log.ServiceName === "dokploy-service-app@file") { return null; } + // Exclude Dashboard requests - they start with /dashboard + if (log.RequestPath?.startsWith("/dashboard")) { + return null; + } const date = new Date(log.StartUTC); if (dateRange?.start || dateRange?.end) { @@ -97,6 +101,10 @@ export function parseRawConfig( } }) .compact() + .filter((log) => { + // Exclude Dashboard requests - they start with /dashboard + return !log.RequestPath?.startsWith("/dashboard"); + }) .value(); // Apply date range filter if provided diff --git a/packages/server/src/utils/traefik/application.ts b/packages/server/src/utils/traefik/application.ts index b18161c76..80f7c1476 100644 --- a/packages/server/src/utils/traefik/application.ts +++ b/packages/server/src/utils/traefik/application.ts @@ -162,7 +162,11 @@ export const readMonitoringConfig = async (readAll = false) => { trimmed.endsWith("}") ) { const log = JSON.parse(trimmed); - if (log.ServiceName !== "dokploy-service-app@file") { + // Exclude Dokploy service app and Dashboard requests + if ( + log.ServiceName !== "dokploy-service-app@file" && + !log.RequestPath?.startsWith("/dashboard") + ) { content += `${line}\n`; validCount++; if (validCount >= 500) { From 7998b296a29ed78a8b82dcdaec173696cc6a02d7 Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Tue, 9 Dec 2025 23:16:04 -0600 Subject: [PATCH 2/3] feat(logs): filter out Dokploy dashboard requests from logs processing - Added a test case to ensure Dokploy dashboard requests are filtered out correctly. - Updated the logs processing logic to exclude both Dokploy service app and dashboard requests, improving log clarity and relevance. --- apps/dokploy/__test__/requests/request.test.ts | 16 ++++++++++++++++ packages/server/src/utils/access-log/utils.ts | 13 +++++-------- packages/server/src/utils/traefik/application.ts | 5 +---- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/apps/dokploy/__test__/requests/request.test.ts b/apps/dokploy/__test__/requests/request.test.ts index 53ca8d777..70852494d 100644 --- a/apps/dokploy/__test__/requests/request.test.ts +++ b/apps/dokploy/__test__/requests/request.test.ts @@ -54,4 +54,20 @@ describe("processLogs", () => { const result = parseRawConfig(entryWithWhitespace); expect(result.data).toHaveLength(2); }); + + it("should filter out Dokploy dashboard requests", () => { + const dokployDashboardEntry = `{"ClientAddr":"172.71.187.131:9485","ClientHost":"172.71.187.131","ClientPort":"9485","ClientUsername":"-","DownstreamContentSize":14550,"DownstreamStatus":200,"Duration":57681682,"OriginContentSize":14550,"OriginDuration":57612242,"OriginStatus":200,"Overhead":69440,"RequestAddr":"hostinger.dokploy.com","RequestContentSize":0,"RequestCount":20142,"RequestHost":"hostinger.dokploy.com","RequestMethod":"GET","RequestPath":"/_next/data/cb_zzI4Rp9G7Q7djrFKh0/en/dashboard/traefik.json","RequestPort":"-","RequestProtocol":"HTTP/2.0","RequestScheme":"https","RetryAttempts":0,"RouterName":"dokploy-router-app-secure@file","ServiceAddr":"dokploy:3000","ServiceName":"dokploy-service-app@file","ServiceURL":"http://dokploy:3000","StartLocal":"2025-12-10T05:10:41.957755949Z","StartUTC":"2025-12-10T05:10:41.957755949Z","TLSCipher":"TLS_AES_128_GCM_SHA256","TLSVersion":"1.3","entryPointName":"websecure","level":"info","msg":"","time":"2025-12-10T05:10:42Z"}`; + + // Test with only Dokploy dashboard entry - should be filtered out + const resultOnlyDokploy = parseRawConfig(dokployDashboardEntry); + expect(resultOnlyDokploy.data).toHaveLength(0); + expect(resultOnlyDokploy.totalCount).toBe(0); + + // Test with mixed entries - Dokploy should be filtered, others should remain + const mixedEntries = `${dokployDashboardEntry}\n${sampleLogEntry}`; + const resultMixed = parseRawConfig(mixedEntries); + expect(resultMixed.data).toHaveLength(1); + expect(resultMixed.totalCount).toBe(1); + expect(resultMixed.data[0]?.ServiceName).not.toBe("dokploy-service-app@file"); + }); }); diff --git a/packages/server/src/utils/access-log/utils.ts b/packages/server/src/utils/access-log/utils.ts index b9b4fd879..b89dc2ed2 100644 --- a/packages/server/src/utils/access-log/utils.ts +++ b/packages/server/src/utils/access-log/utils.ts @@ -27,10 +27,6 @@ export function processLogs( if (log.ServiceName === "dokploy-service-app@file") { return null; } - // Exclude Dashboard requests - they start with /dashboard - if (log.RequestPath?.startsWith("/dashboard")) { - return null; - } const date = new Date(log.StartUTC); if (dateRange?.start || dateRange?.end) { @@ -101,12 +97,13 @@ export function parseRawConfig( } }) .compact() - .filter((log) => { - // Exclude Dashboard requests - they start with /dashboard - return !log.RequestPath?.startsWith("/dashboard"); - }) .value(); + // Filter out Dokploy dashboard requests + parsedLogs = parsedLogs.filter( + (log) => log.ServiceName !== "dokploy-service-app@file", + ); + // Apply date range filter if provided if (dateRange?.start || dateRange?.end) { parsedLogs = parsedLogs.filter((log) => { diff --git a/packages/server/src/utils/traefik/application.ts b/packages/server/src/utils/traefik/application.ts index 80f7c1476..e3b86609f 100644 --- a/packages/server/src/utils/traefik/application.ts +++ b/packages/server/src/utils/traefik/application.ts @@ -163,10 +163,7 @@ export const readMonitoringConfig = async (readAll = false) => { ) { const log = JSON.parse(trimmed); // Exclude Dokploy service app and Dashboard requests - if ( - log.ServiceName !== "dokploy-service-app@file" && - !log.RequestPath?.startsWith("/dashboard") - ) { + if (log.ServiceName !== "dokploy-service-app@file") { content += `${line}\n`; validCount++; if (validCount >= 500) { From 0cfe87cb722721cb5451eeecb40aa3566475b54e Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Wed, 10 Dec 2025 05:16:25 +0000 Subject: [PATCH 3/3] [autofix.ci] apply automated fixes --- apps/dokploy/__test__/requests/request.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/dokploy/__test__/requests/request.test.ts b/apps/dokploy/__test__/requests/request.test.ts index 70852494d..3f58ac439 100644 --- a/apps/dokploy/__test__/requests/request.test.ts +++ b/apps/dokploy/__test__/requests/request.test.ts @@ -57,7 +57,7 @@ describe("processLogs", () => { it("should filter out Dokploy dashboard requests", () => { const dokployDashboardEntry = `{"ClientAddr":"172.71.187.131:9485","ClientHost":"172.71.187.131","ClientPort":"9485","ClientUsername":"-","DownstreamContentSize":14550,"DownstreamStatus":200,"Duration":57681682,"OriginContentSize":14550,"OriginDuration":57612242,"OriginStatus":200,"Overhead":69440,"RequestAddr":"hostinger.dokploy.com","RequestContentSize":0,"RequestCount":20142,"RequestHost":"hostinger.dokploy.com","RequestMethod":"GET","RequestPath":"/_next/data/cb_zzI4Rp9G7Q7djrFKh0/en/dashboard/traefik.json","RequestPort":"-","RequestProtocol":"HTTP/2.0","RequestScheme":"https","RetryAttempts":0,"RouterName":"dokploy-router-app-secure@file","ServiceAddr":"dokploy:3000","ServiceName":"dokploy-service-app@file","ServiceURL":"http://dokploy:3000","StartLocal":"2025-12-10T05:10:41.957755949Z","StartUTC":"2025-12-10T05:10:41.957755949Z","TLSCipher":"TLS_AES_128_GCM_SHA256","TLSVersion":"1.3","entryPointName":"websecure","level":"info","msg":"","time":"2025-12-10T05:10:42Z"}`; - + // Test with only Dokploy dashboard entry - should be filtered out const resultOnlyDokploy = parseRawConfig(dokployDashboardEntry); expect(resultOnlyDokploy.data).toHaveLength(0); @@ -68,6 +68,8 @@ describe("processLogs", () => { const resultMixed = parseRawConfig(mixedEntries); expect(resultMixed.data).toHaveLength(1); expect(resultMixed.totalCount).toBe(1); - expect(resultMixed.data[0]?.ServiceName).not.toBe("dokploy-service-app@file"); + expect(resultMixed.data[0]?.ServiceName).not.toBe( + "dokploy-service-app@file", + ); }); });