diff --git a/client/src/Hooks/useMonitorForm.ts b/client/src/Hooks/useMonitorForm.ts index 5458a75d8..043796ccb 100644 --- a/client/src/Hooks/useMonitorForm.ts +++ b/client/src/Hooks/useMonitorForm.ts @@ -77,6 +77,7 @@ export const getMonitorDefaults = ( ...base, type: "docker", url: data?.url || "", + dockerLogsEnabled: data?.dockerLogsEnabled ?? false, }; break; case "game": diff --git a/client/src/Pages/CreateMonitor/index.tsx b/client/src/Pages/CreateMonitor/index.tsx index 5c2b693e0..443170ba7 100644 --- a/client/src/Pages/CreateMonitor/index.tsx +++ b/client/src/Pages/CreateMonitor/index.tsx @@ -255,6 +255,7 @@ const CreateMonitorPage = () => { const firstSegment = pathSegments[0]; if (firstSegment === "pagespeed") return "pagespeed"; if (firstSegment === "infrastructure") return "hardware"; + if (firstSegment === "docker") return "docker"; return "uptime"; }, [location.pathname]); @@ -264,7 +265,9 @@ const CreateMonitorPage = () => { ? "pagespeed" : pageType === "hardware" ? "hardware" - : "http"; + : pageType === "docker" + ? "docker" + : "http"; const { data: existingMonitor, refetch: refetchMonitor } = useGet( isEditMode ? `/monitors/${monitorId}` : null @@ -823,6 +826,19 @@ const CreateMonitorPage = () => { /> )} + {showStep(1) && watchedType === "docker" && ( + + } + /> + )} + {showStep(2) && (watchedType === "http" || watchedType === "grpc" || diff --git a/client/src/Types/Monitor.ts b/client/src/Types/Monitor.ts index 300bd2ce4..c81df9c82 100644 --- a/client/src/Types/Monitor.ts +++ b/client/src/Types/Monitor.ts @@ -159,6 +159,7 @@ export interface Monitor { geoCheckEnabled?: boolean; geoCheckLocations?: GeoContinent[]; geoCheckInterval?: number; + dockerLogsEnabled?: boolean; dnsServer?: string; dnsRecordType?: DnsRecordType; recentChecks: CheckSnapshot[]; diff --git a/client/src/Validation/monitor.ts b/client/src/Validation/monitor.ts index 00ab3aaff..0cc832405 100644 --- a/client/src/Validation/monitor.ts +++ b/client/src/Validation/monitor.ts @@ -112,6 +112,7 @@ const portSchema = baseSchema.extend({ const dockerSchema = baseSchema.extend({ type: z.literal("docker"), url: z.string().min(1, "Container ID is required"), + dockerLogsEnabled: z.boolean().register(monitorStepRegistry, { step: 1 }), }); // Game server monitor schema diff --git a/client/src/locales/en.json b/client/src/locales/en.json index af1a11f4b..ce8ff03dc 100644 --- a/client/src/locales/en.json +++ b/client/src/locales/en.json @@ -814,6 +814,15 @@ } } }, + "dockerLogs": { + "title": "Container logs", + "description": "Collect the most recent log lines from every container on this host on each check. Logs are kept for 7 days. Leave this off for hosts with chatty containers to save database space.", + "option": { + "enabled": { + "label": "Collect container logs" + } + } + }, "stats": { "title": "Monitor history", "description": "Clear all monitoring history and statistics for your team. This action is irreversible.",