diff --git a/ui/litellm-dashboard/src/components/view_logs/index.tsx b/ui/litellm-dashboard/src/components/view_logs/index.tsx index c44015cd9e7..357597698dc 100644 --- a/ui/litellm-dashboard/src/components/view_logs/index.tsx +++ b/ui/litellm-dashboard/src/components/view_logs/index.tsx @@ -710,8 +710,8 @@ export default function SpendLogsTable({ )} { + const cols = createColumns({ sortBy, sortOrder, onSortChange: (newSortBy, newSortOrder) => { @@ -719,8 +719,9 @@ export default function SpendLogsTable({ setSortOrder(newSortOrder); setCurrentPage(1); }, - }), - ...(initialKeyAlias ? [{ + }); + if (!initialKeyAlias) return cols; + const driftCol = { id: "_driftScore", header: () => Drift Score, cell: ({ row }: { row: { original: { _driftScore?: number } } }) => { @@ -732,8 +733,12 @@ export default function SpendLogsTable({ ); }, - }] : []), - ]} + }; + // Insert right after the Status column + const statusIdx = cols.findIndex((c: any) => c.header === "Status" || c.accessorKey === "metadata.status"); + const insertAt = statusIdx >= 0 ? statusIdx + 1 : 3; + return [...cols.slice(0, insertAt), driftCol, ...cols.slice(insertAt)]; + })()} data={filteredData} onRowClick={handleRowClick} isLoading={logs.isLoading}