From 6ee1376673a2079ebdd07d1b605a10caccf3a003 Mon Sep 17 00:00:00 2001 From: tanjiro <56165694+NANDINI-star@users.noreply.github.com> Date: Sat, 14 Jun 2025 06:31:49 +0900 Subject: [PATCH] Add Live Tail Feature to Logs View (#11712) * add live tail feature * improve time interval * auto-refresh every 15 seconds * remove last 1 minute option --- .../src/components/view_logs/index.tsx | 88 ++++++++++++++++--- .../src/components/view_logs/logs_utils.tsx | 12 +-- 2 files changed, 83 insertions(+), 17 deletions(-) diff --git a/ui/litellm-dashboard/src/components/view_logs/index.tsx b/ui/litellm-dashboard/src/components/view_logs/index.tsx index c6654a0b229..b90b46ec013 100644 --- a/ui/litellm-dashboard/src/components/view_logs/index.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/index.tsx @@ -80,7 +80,6 @@ export default function SpendLogsTable({ moment().format("YYYY-MM-DDTHH:mm") ); - // Add these new state variables at the top with other useState declarations const [isCustomDate, setIsCustomDate] = useState(false); const [quickSelectOpen, setQuickSelectOpen] = useState(false); const [tempTeamId, setTempTeamId] = useState(""); @@ -101,6 +100,13 @@ export default function SpendLogsTable({ const queryClient = useQueryClient(); + const [isLiveTail, setIsLiveTail] = useState(true); // Default to true + + const [selectedTimeInterval, setSelectedTimeInterval] = useState<{ value: number; unit: string }>({ + value: 24, + unit: "hours" + }); + useEffect(() => { const fetchKeyInfo = async () => { if (selectedKeyIdInfoView && accessToken) { @@ -152,6 +158,23 @@ export default function SpendLogsTable({ } }, [userRole]); + const LiveTailControls = () => { + return ( +