Renamings

This commit is contained in:
Adria Navarro 2023-07-11 10:39:37 +02:00
parent 8c8317253a
commit 0b5717cde5
4 changed files with 9 additions and 7 deletions

View File

@ -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),
}
}

View File

@ -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

View File

@ -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

View File

@ -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