mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-10 18:29:07 +00:00
Review fixes
This commit is contained in:
@@ -1,22 +1,20 @@
|
|||||||
// Specific DataDog log intake hostnames
|
|
||||||
const dataDogHostnames = [
|
|
||||||
"http-intake.logs.datadoghq.com",
|
|
||||||
"http-intake.logs.us3.datadoghq.com",
|
|
||||||
"http-intake.logs.us5.datadoghq.com",
|
|
||||||
"http-intake.logs.datadoghq.eu",
|
|
||||||
"http-intake.logs.ap1.datadoghq.com",
|
|
||||||
"http-intake.logs.ddog-gov.com"
|
|
||||||
];
|
|
||||||
|
|
||||||
export function providerSpecificPayload(url: string) {
|
export function providerSpecificPayload(url: string) {
|
||||||
|
const { hostname } = new URL(url);
|
||||||
|
|
||||||
const payload: Record<string, string> = {};
|
const payload: Record<string, string> = {};
|
||||||
|
|
||||||
// If URL is for DataDog, add a "ddsource: infisical" entry
|
switch (hostname) {
|
||||||
if (
|
case "http-intake.logs.datadoghq.com":
|
||||||
dataDogHostnames.some((hostname) => url.startsWith(`https://${hostname}`) || url.startsWith(`http://${hostname}`))
|
case "http-intake.logs.us3.datadoghq.com":
|
||||||
) {
|
case "http-intake.logs.us5.datadoghq.com":
|
||||||
payload.ddsource = "infisical";
|
case "http-intake.logs.datadoghq.eu":
|
||||||
payload.service = "audit-logs";
|
case "http-intake.logs.ap1.datadoghq.com":
|
||||||
|
case "http-intake.logs.ddog-gov.com":
|
||||||
|
payload.ddsource = "infisical";
|
||||||
|
payload.service = "audit-logs";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return payload;
|
return payload;
|
||||||
|
|||||||
@@ -143,13 +143,12 @@ export const auditLogQueueServiceFactory = async ({
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
logger.info(
|
logger.info(
|
||||||
`Successfully streamed audit log to ${url} for org ${orgId}. Response body: ${JSON.stringify(response.data)}`
|
`Successfully streamed audit log [url=${url}] for org [orgId=${orgId}] [response=${JSON.stringify(response.data)}]`
|
||||||
);
|
);
|
||||||
return response;
|
return response;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(
|
logger.error(
|
||||||
`Failed to stream audit log to ${url} for org ${orgId}. Error:`,
|
`Failed to stream audit log [url=${url}] for org [orgId=${orgId}] [error=${(error as AxiosError).message}]`
|
||||||
(error as AxiosError).message
|
|
||||||
);
|
);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
@@ -249,13 +248,12 @@ export const auditLogQueueServiceFactory = async ({
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
logger.info(
|
logger.info(
|
||||||
`Successfully streamed audit log to ${url} for org ${orgId}. Response body: ${JSON.stringify(response.data)}`
|
`Successfully streamed audit log [url=${url}] for org [orgId=${orgId}] [response=${JSON.stringify(response.data)}]`
|
||||||
);
|
);
|
||||||
return response;
|
return response;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(
|
logger.error(
|
||||||
`Failed to stream audit log to ${url} for org ${orgId}. Error:`,
|
`Failed to stream audit log [url=${url}] for org [orgId=${orgId}] [error=${(error as AxiosError).message}]`
|
||||||
(error as AxiosError).message
|
|
||||||
);
|
);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user