diff --git a/packages/frontend-core/src/api/index.js b/packages/frontend-core/src/api/index.js index b756fcbdf2..5bffb82f4d 100644 --- a/packages/frontend-core/src/api/index.js +++ b/packages/frontend-core/src/api/index.js @@ -30,7 +30,7 @@ import { buildBackupsEndpoints } from "./backups" import { buildEnvironmentVariableEndpoints } from "./environmentVariables" import { buildEventEndpoints } from "./events" import { buildAuditLogsEndpoints } from "./auditLogs" -import { buildSystemLogsEndpoints } from "./systemLogs" +import { buildLogsEndpoints } from "./logs" /** * Random identifier to uniquely identify a session in a tab. This is @@ -278,6 +278,6 @@ export const createAPIClient = config => { ...buildEnvironmentVariableEndpoints(API), ...buildEventEndpoints(API), ...buildAuditLogsEndpoints(API), - ...buildSystemLogsEndpoints(API), + ...buildLogsEndpoints(API), } } diff --git a/packages/frontend-core/src/api/systemLogs.js b/packages/frontend-core/src/api/logs.js similarity index 71% rename from packages/frontend-core/src/api/systemLogs.js rename to packages/frontend-core/src/api/logs.js index 33a3928002..b6cb98627c 100644 --- a/packages/frontend-core/src/api/systemLogs.js +++ b/packages/frontend-core/src/api/logs.js @@ -1,10 +1,10 @@ -export const buildSystemLogsEndpoints = API => ({ +export const buildLogsEndpoints = API => ({ /** * Gets a stream for the system logs. */ getSystemLogs: async () => { return await API.get({ - url: "/api/global/system/logs", + url: "/api/system/logs", json: false, parseResponse: async response => { return response diff --git a/packages/worker/src/api/controllers/system/logs.ts b/packages/worker/src/api/controllers/system/logs.ts index 6b3c70f664..f3b9438723 100644 --- a/packages/worker/src/api/controllers/system/logs.ts +++ b/packages/worker/src/api/controllers/system/logs.ts @@ -1,10 +1,12 @@ import { UserCtx } from "@budibase/types" -import { context, logging } from "@budibase/backend-core" +import { installation, logging } from "@budibase/backend-core" export async function getLogs(ctx: UserCtx) { const logReadStream = logging.system.getLogReadStream() - const fileName = `${context.getTenantId()}-${Date.now()}.logs` + const { installId } = await installation.getInstall() + + const fileName = `${installId}-${Date.now()}.logs` ctx.set("content-disposition", `attachment; filename=${fileName}`) ctx.body = logReadStream diff --git a/packages/worker/src/api/routes/system/logs.ts b/packages/worker/src/api/routes/system/logs.ts index 98ebcab24e..dcb95b5c8a 100644 --- a/packages/worker/src/api/routes/system/logs.ts +++ b/packages/worker/src/api/routes/system/logs.ts @@ -4,6 +4,6 @@ import * as controller from "../../controllers/system/logs" const router: Router = new Router() -router.get("/api/global/system/logs", middleware.adminOnly, controller.getLogs) +router.get("/api/system/logs", middleware.adminOnly, controller.getLogs) export default router