Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

add new audit log streaming provider

Thiago Araujo da Silvaf04995b69a45
diff --git a/backend/src/ee/routes/v1/audit-log-stream-routers/audit-log-stream-router.ts b/backend/src/ee/routes/v1/audit-log-stream-routers/audit-log-stream-router.ts
index 48eed14c9e..b089e9c2ee 100644
--- a/backend/src/ee/routes/v1/audit-log-stream-routers/audit-log-stream-router.ts
+++ b/backend/src/ee/routes/v1/audit-log-stream-routers/audit-log-stream-router.ts
@@ -20,6 +20,10 @@ import {
SanitizedSplunkProviderSchema,
SplunkProviderListItemSchema
} from "@app/ee/services/audit-log-stream/splunk/splunk-provider-schemas";
+import {
+ SanitizedSumoLogicProviderSchema,
+ SumoLogicProviderListItemSchema
+} from "@app/ee/services/audit-log-stream/sumo-logic/sumo-logic-provider-schemas";
import { readLimit } from "@app/server/config/rateLimiter";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMode } from "@app/services/auth/auth-type";
@@ -29,7 +33,8 @@ const SanitizedAuditLogStreamSchema = z.union([
SanitizedDatadogProviderSchema,
SanitizedSplunkProviderSchema,
SanitizedAzureProviderSchema,
- SanitizedCriblProviderSchema
+ SanitizedCriblProviderSchema,
+ SanitizedSumoLogicProviderSchema
]);
const ProviderOptionsSchema = z.discriminatedUnion("provider", [
@@ -37,7 +42,8 @@ const ProviderOptionsSchema = z.discriminatedUnion("provider", [
DatadogProviderListItemSchema,
SplunkProviderListItemSchema,
AzureProviderListItemSchema,
- CriblProviderListItemSchema
+ CriblProviderListItemSchema,
+ SumoLogicProviderListItemSchema
]);
export const registerAuditLogStreamRouter = async (server: FastifyZodProvider) => {
diff --git a/backend/src/ee/routes/v1/audit-log-stream-routers/index.ts b/backend/src/ee/routes/v1/audit-log-stream-routers/index.ts
index ad338c8011..e3bb934e4f 100644
--- a/backend/src/ee/routes/v1/audit-log-stream-routers/index.ts
+++ b/backend/src/ee/routes/v1/audit-log-stream-routers/index.ts
@@ -24,6 +24,11 @@ import {
SanitizedSplunkProviderSchema,
UpdateSplunkProviderLogStreamSchema
} from "@app/ee/services/audit-log-stream/splunk/splunk-provider-schemas";
+import {
+ CreateSumoLogicProviderLogStreamSchema,
+ SanitizedSumoLogicProviderSchema,
+ UpdateSumoLogicProviderLogStreamSchema
+} from "@app/ee/services/audit-log-stream/sumo-logic/sumo-logic-provider-schemas";
import { registerAuditLogStreamEndpoints } from "./audit-log-stream-endpoints";
@@ -75,5 +80,14 @@ export const AUDIT_LOG_STREAM_REGISTER_ROUTER_MAP: Record<LogProvider, (server:
createSchema: CreateCriblProviderLogStreamSchema,
updateSchema: UpdateCriblProviderLogStreamSchema
});
+ },
+ [LogProvider.SumoLogic]: async (server: FastifyZodProvider) => {
+ registerAuditLogStreamEndpoints({
+ server,
+ provider: LogProvider.SumoLogic,
+ sanitizedResponseSchema: SanitizedSumoLogicProviderSchema,
+ createSchema: CreateSumoLogicProviderLogStreamSchema,
+ updateSchema: UpdateSumoLogicProviderLogStreamSchema
+ });
}
};
diff --git a/backend/src/ee/services/audit-log-stream/audit-log-stream-enums.ts b/backend/src/ee/services/audit-log-stream/audit-log-stream-enums.ts
index 111bed68e6..623456b02b 100644
--- a/backend/src/ee/services/audit-log-stream/audit-log-stream-enums.ts
+++ b/backend/src/ee/services/audit-log-stream/audit-log-stream-enums.ts
@@ -3,7 +3,8 @@ export enum LogProvider {
Cribl = "cribl",
Custom = "custom",
Datadog = "datadog",
- Splunk = "splunk"
+ Splunk = "splunk",
+ SumoLogic = "sumo-logic"
}
export enum StreamMode {
diff --git a/backend/src/ee/services/audit-log-stream/audit-log-stream-factory.ts b/backend/src/ee/services/audit-log-stream/audit-log-stream-factory.ts
index 8dde0e0795..ad1a8e541e 100644
--- a/backend/src/ee/services/audit-log-stream/audit-log-stream-factory.ts
+++ b/backend/src/ee/services/audit-log-stream/audit-log-stream-factory.ts
@@ -5,6 +5,7 @@ import { CriblProviderFactory } from "./cribl/cribl-provider-factory";
import { CustomProviderFactory } from "./custom/custom-provider-factory";
import { DatadogProviderFactory } from "./datadog/datadog-provider-factory";
import { SplunkProviderFactory } from "./splunk/splunk-provider-factory";
+import { SumoLogicProviderFactory } from "./sumo-logic/sumo-logic-provider-factory";
type TLogStreamFactoryImplementation = TLogStreamFactory<TAuditLogStreamCredentials>;
@@ -13,5 +14,6 @@ export const LOG_STREAM_FACTORY_MAP: Record<LogProvider, TLogStreamFactoryImplem
[LogProvider.Datadog]: DatadogProviderFactory as TLogStreamFactoryImplementation,
[LogProvider.Splunk]: SplunkProviderFactory as TLogStreamFactoryImplementation,
[LogProvider.Custom]: CustomProviderFactory as TLogStreamFactoryImplementation,
- [LogProvider.Cribl]: CriblProviderFactory as TLogStreamFactoryImplementation
+ [LogProvider.Cribl]: CriblProviderFactory as TLogStreamFactoryImplementation,
+ [LogProvider.SumoLogic]: SumoLogicProviderFactory as TLogStreamFactoryImplementation
};
diff --git a/backend/src/ee/services/audit-log-stream/audit-log-stream-fns.ts b/backend/src/ee/services/audit-log-stream/audit-log-stream-fns.ts
index 05db453aae..6877849d31 100644
--- a/backend/src/ee/services/audit-log-stream/audit-log-stream-fns.ts
+++ b/backend/src/ee/services/audit-log-stream/audit-log-stream-fns.ts
@@ -10,6 +10,7 @@ import { getCriblProviderListItem } from "./cribl/cribl-provider-fns";
import { getCustomProviderListItem } from "./custom/custom-provider-fns";
import { getDatadogProviderListItem } from "./datadog/datadog-provider-fns";
import { getSplunkProviderListItem } from "./splunk/splunk-provider-fns";
+import { getSumoLogicProviderListItem } from "./sumo-logic/sumo-logic-provider-fns";
export const listProviderOptions = () => {
return [
@@ -17,7 +18,8 @@ export const listProviderOptions = () => {
getSplunkProviderListItem(),
getCustomProviderListItem(),
getAzureProviderListItem(),
- getCriblProviderListItem()
+ getCriblProviderListItem(),
+ getSumoLogicProviderListItem()
].sort((a, b) => a.name.localeCompare(b.name));
};
diff --git a/backend/src/ee/services/audit-log-stream/audit-log-stream-types.ts b/backend/src/ee/services/audit-log-stream/audit-log-stream-types.ts
index 5d882a997a..ec66245727 100644
--- a/backend/src/ee/services/audit-log-stream/audit-log-stream-types.ts
+++ b/backend/src/ee/services/audit-log-stream/audit-log-stream-types.ts
@@ -7,15 +7,23 @@ import { TCriblProvider, TCriblProviderCredentials } from "./cribl/cribl-provide
import { TCustomProvider, TCustomProviderCredentials } from "./custom/custom-provider-types";
import { TDatadogProvider, TDatadogProviderCredentials } from "./datadog/datadog-provider-types";
import { TSplunkProvider, TSplunkProviderCredentials } from "./splunk/splunk-provider-types";
+import { TSumoLogicProvider, TSumoLogicProviderCredentials } from "./sumo-logic/sumo-logic-provider-types";
-export type TAuditLogStream = TDatadogProvider | TSplunkProvider | TCustomProvider | TAzureProvider | TCriblProvider;
+export type TAuditLogStream =
+ | TDatadogProvider
+ | TSplunkProvider
+ | TCustomProvider
+ | TAzureProvider
+ | TCriblProvider
+ | TSumoLogicProvider;
export type TAuditLogStreamCredentials =
| TDatadogProviderCredentials
| TSplunkProviderCredentials
| TCustomProviderCredentials
| TAzureProviderCredentials
- | TCriblProviderCredentials;
+ | TCriblProviderCredentials
+ | TSumoLogicProviderCredentials;
export type TCreateAuditLogStreamDTO = {
provider: LogProvider;
diff --git a/backend/src/ee/services/audit-log-stream/sumo-logic/sumo-logic-provider-factory.ts b/backend/src/ee/services/audit-log-stream/sumo-logic/sumo-logic-provider-factory.ts
new file mode 100644
index 0000000000..ebd32990b2
--- /dev/null
+++ b/backend/src/ee/services/audit-log-stream/sumo-logic/sumo-logic-provider-factory.ts
@@ -0,0 +1,74 @@
+import { RawAxiosRequestHeaders } from "axios";
+
+import { request } from "@app/lib/config/request";
+import { BadRequestError } from "@app/lib/errors";
+import { blockLocalAndPrivateIpAddresses } from "@app/lib/validator";
+
+import { AUDIT_LOG_STREAM_BATCH_TIMEOUT, AUDIT_LOG_STREAM_TIMEOUT } from "../../audit-log/audit-log-queue";
+import {
+ TLogStreamFactoryBatchStreamLog,
+ TLogStreamFactoryGetProviderBatchLimit,
+ TLogStreamFactoryValidateCredentials
+} from "../audit-log-stream-types";
+import { TSumoLogicProviderCredentials } from "./sumo-logic-provider-types";
+
+const buildStreamHeaders = (
+ credentials: TSumoLogicProviderCredentials,
+ contentType: string
+): RawAxiosRequestHeaders => {
+ const streamHeaders: RawAxiosRequestHeaders = { "Content-Type": contentType };
+ if (credentials.token) {
+ streamHeaders["x-sumo-token"] = credentials.token;
+ }
+ return streamHeaders;
+};
+
+export const SumoLogicProviderFactory = () => {
+ const validateCredentials: TLogStreamFactoryValidateCredentials<TSumoLogicProviderCredentials> = async ({
+ credentials
+ }) => {
+ const { url } = credentials;
+
+ await blockLocalAndPrivateIpAddresses(url);
+
+ await request
+ .post(url, JSON.stringify({ ping: "ok" }), {
+ headers: buildStreamHeaders(credentials, "application/json"),
+ timeout: AUDIT_LOG_STREAM_TIMEOUT
+ })
+ .catch((err) => {
+ throw new BadRequestError({ message: `Failed to connect with Sumo Logic: ${(err as Error)?.message}` });
+ });
+
+ return credentials;
+ };
+
+ const batchStreamLog: TLogStreamFactoryBatchStreamLog<TSumoLogicProviderCredentials> = async ({
+ credentials,
+ auditLogs
+ }) => {
+ if (auditLogs.length === 0) return;
+
+ const { url } = credentials;
+
+ await blockLocalAndPrivateIpAddresses(url);
+
+ const body = auditLogs.map((auditLog) => JSON.stringify(auditLog)).join("\n");
+
+ await request.post(url, body, {
+ headers: buildStreamHeaders(credentials, "application/x-ndjson"),
+ timeout: AUDIT_LOG_STREAM_BATCH_TIMEOUT
+ });
+ };
+
+ const getProviderBatchLimit: TLogStreamFactoryGetProviderBatchLimit = () => ({
+ maxLogs: 900,
+ maxBytes: 700 * 1024
+ });
+
+ return {
+ validateCredentials,
+ batchStreamLog,
+ getProviderBatchLimit
+ };
+};
diff --git a/backend/src/ee/services/audit-log-stream/sumo-logic/sumo-logic-provider-fns.ts b/backend/src/ee/services/audit-log-stream/sumo-logic/sumo-logic-provider-fns.ts
new file mode 100644
index 0000000000..3849c34fea
--- /dev/null
+++ b/backend/src/ee/services/audit-log-stream/sumo-logic/sumo-logic-provider-fns.ts
@@ -0,0 +1,8 @@
+import { LogProvider } from "../audit-log-stream-enums";
+
+export const getSumoLogicProviderListItem = () => {
+ return {
+ name: "Sumo Logic" as const,
+ provider: LogProvider.SumoLogic as const
+ };
+};
diff --git a/backend/src/ee/services/audit-log-stream/sumo-logic/sumo-logic-provider-schemas.ts b/backend/src/ee/services/audit-log-stream/sumo-logic/sumo-logic-provider-schemas.ts
new file mode 100644
index 0000000000..1cb78028b6
--- /dev/null
+++ b/backend/src/ee/services/audit-log-stream/sumo-logic/sumo-logic-provider-schemas.ts
@@ -0,0 +1,35 @@
+import { z } from "zod";
+
+import { LogProvider, StreamMode } from "../audit-log-stream-enums";
+import { BaseProviderSchema } from "../audit-log-stream-schemas";
+
+export const SumoLogicProviderCredentialsSchema = z.object({
+ url: z.string().url().trim().min(1).max(255),
+ token: z.string().trim().max(255).optional()
+});
+
+const BaseSumoLogicProviderSchema = BaseProviderSchema.extend({ provider: z.literal(LogProvider.SumoLogic) });
+
+export const SumoLogicProviderSchema = BaseSumoLogicProviderSchema.extend({
+ credentials: SumoLogicProviderCredentialsSchema
+});
+
+export const SanitizedSumoLogicProviderSchema = BaseSumoLogicProviderSchema.extend({
+ credentials: SumoLogicProviderCredentialsSchema.pick({
+ url: true
+ })
+});
+
+export const SumoLogicProviderListItemSchema = z.object({
+ name: z.literal("Sumo Logic"),
+ provider: z.literal(LogProvider.SumoLogic)
+});
+
+export const CreateSumoLogicProviderLogStreamSchema = z.object({
+ credentials: SumoLogicProviderCredentialsSchema
+});
+
+export const UpdateSumoLogicProviderLogStreamSchema = z.object({
+ credentials: SumoLogicProviderCredentialsSchema,
+ streamMode: z.nativeEnum(StreamMode).optional()
+});
diff --git a/backend/src/ee/services/audit-log-stream/sumo-logic/sumo-logic-provider-types.ts b/backend/src/ee/services/audit-log-stream/sumo-logic/sumo-logic-provider-types.ts
new file mode 100644
index 0000000000..fd89429259
--- /dev/null
+++ b/backend/src/ee/services/audit-log-stream/sumo-logic/sumo-logic-provider-types.ts
@@ -0,0 +1,7 @@
+import { z } from "zod";
+
+import { SumoLogicProviderCredentialsSchema, SumoLogicProviderSchema } from "./sumo-logic-provider-schemas";
+
+export type TSumoLogicProvider = z.infer<typeof SumoLogicProviderSchema>;
+
+export type TSumoLogicProviderCredentials = z.infer<typeof SumoLogicProviderCredentialsSchema>;
diff --git a/docs/documentation/platform/audit-log-streams/audit-log-streams.mdx b/docs/documentation/platform/audit-log-streams/audit-log-streams.mdx
index e28ff9ba18..8585f7b3c1 100644
--- a/docs/documentation/platform/audit-log-streams/audit-log-streams.mdx
+++ b/docs/documentation/platform/audit-log-streams/audit-log-streams.mdx
@@ -332,6 +332,57 @@ This prevents audit logs from being written to PostgreSQL while still streaming
![custom provider](/images/platform/audit-log-streams/custom-provider.png)
+ Once you're finished, click **Create Log Stream**.
+ </Step>
+ </Steps>
+ </Accordion>
+ <Accordion title="Sumo Logic">
+ You can stream to Sumo Logic using the dedicated **Sumo Logic** provider log stream. Infisical delivers audit logs to Sumo Logic's **HTTP Logs and Metrics Source** as a newline-delimited JSON (NDJSON) batch, where each line is ingested as an individual log message.
+
+ <Steps>
+ <Step title="Create an HTTP Source in Sumo Logic">
+ In Sumo Logic, navigate to **Manage Data > Collection > Collection**.
+
+ If you don't already have a hosted collector, click **Add Collector**, choose **Hosted Collector**, and save it. Otherwise, you can reuse an existing hosted collector.
+
+ On your hosted collector, click **Add Source** and select **HTTP Logs & Metrics**.
+
+ Configure the source:
+
+ | Field | Value |
+ |-------|-------|
+ | **Name** | A descriptive name, e.g. `Infisical Audit Logs` |
+ | **Source Category** | A category to query against, e.g. `infisical/audit-logs` |
+
+ Click **Save**. When prompted to generate the URL, select the **Auth Header** option (_"Use a base URL with separate authentication header"_). Sumo Logic will display two values:
+
+ - **URL**: the base endpoint, e.g. `https://endpoint4.collection.sumologic.com/receiver/v1/http`
+ - **Header**: the authentication header, shown as `x-sumo-token: <token>`
+
+ Copy both for the next step.
+
+ <Warning>
+ The **Header** field includes the header name prefix (`x-sumo-token: `). When copying the token, copy **only the token value** that comes after `x-sumo-token: ` — do **not** include the `x-sumo-token: ` prefix itself.
+ </Warning>
+
+ <Note>
+ The token authenticates the request, so treat it as a secret. You can regenerate it later from the source settings if needed.
+ </Note>
+ </Step>
+ <Step title="Create Audit Log Stream on Infisical">
+ On Infisical, create a new audit log stream and select the **Sumo Logic** provider option.
+
+ - **HTTP Source Address**: The **URL** from Step 1 (e.g. `https://endpoint4.collection.sumologic.com/receiver/v1/http`).
+ - **Auth Token**: The token value from the **Header** field in Step 1 — only the part after `x-sumo-token: `, not the prefix. Infisical sends it as the `x-sumo-token` header.
+
+ <Note>
+ If you'd rather use a **Presigned URL** instead, select that option in Sumo Logic, set the full presigned URL (with the embedded token) as the **HTTP Source Address**, and leave the **Auth Token** empty. The **Auth Header** approach above is recommended.
+ </Note>
+
+ <Info>
+ Events are delivered as a newline-delimited JSON (NDJSON) batch, bounded to roughly 1 MB per request. See [Delivery Format](#delivery-format) for details.
+ </Info>
+
Once you're finished, click **Create Log Stream**.
</Step>
</Steps>
@@ -384,10 +435,10 @@ For **Custom** streams, each request is an HTTP `POST` with a body containing a
]
```
-Your endpoint must be able to accept a JSON array. Batches are bounded — your receiver should be prepared to handle up to **500 events** or **1 MB** per request. The managed providers (Azure, Cribl, Datadog, Splunk) are batched automatically using each provider's native bulk-ingestion format.
+Your endpoint must be able to accept a JSON array. Batches are bounded — your receiver should be prepared to handle up to **500 events** or **1 MB** per request. The managed providers (Azure, Cribl, Datadog, Splunk, Sumo Logic) are batched automatically using each provider's native bulk-ingestion format.
<Note>
- **Legacy single-event delivery.** **Custom** and **Cribl** streams created before batch delivery was introduced continue to receive **one event per request** as a single JSON object, so existing receivers keep working unchanged. You can upgrade such a stream to batch delivery by editing it and enabling **Batch delivery** in the form. This switch is **one-way** — once a stream is on batch delivery it cannot be reverted to single-event delivery, so confirm your endpoint accepts batched events first (a JSON array for Custom, or newline-delimited JSON (NDJSON) for Cribl). The Azure, Datadog, and Splunk providers always batch and have no single-event mode.
+ **Legacy single-event delivery.** **Custom** and **Cribl** streams created before batch delivery was introduced continue to receive **one event per request** as a single JSON object, so existing receivers keep working unchanged. You can upgrade such a stream to batch delivery by editing it and enabling **Batch delivery** in the form. This switch is **one-way** — once a stream is on batch delivery it cannot be reverted to single-event delivery, so confirm your endpoint accepts batched events first (a JSON array for Custom, or newline-delimited JSON (NDJSON) for Cribl). The Azure, Datadog, Splunk, and Sumo Logic providers always batch and have no single-event mode.
</Note>
### Example Log Entry
diff --git a/frontend/public/images/integrations/SumoLogic.png b/frontend/public/images/integrations/SumoLogic.png
new file mode 100644
index 0000000000..b1fd40f0f4
Binary files /dev/null and b/frontend/public/images/integrations/SumoLogic.png differ
diff --git a/frontend/src/helpers/auditLogStreams.ts b/frontend/src/helpers/auditLogStreams.ts
index ab216957c8..148deae6bf 100644
--- a/frontend/src/helpers/auditLogStreams.ts
+++ b/frontend/src/helpers/auditLogStreams.ts
@@ -13,7 +13,8 @@ export const AUDIT_LOG_STREAM_PROVIDER_MAP: Record<
[LogProvider.Custom]: { name: "Custom", icon: faCode },
[LogProvider.Datadog]: { name: "Datadog", image: "Datadog.png" },
[LogProvider.Splunk]: { name: "Splunk", image: "Splunk.png", size: 65 },
- [LogProvider.QRadar]: { name: "IBM QRadar", image: "IBM.png" }
+ [LogProvider.QRadar]: { name: "IBM QRadar", image: "IBM.png" },
+ [LogProvider.SumoLogic]: { name: "Sumo Logic", image: "SumoLogic.png" }
};
// Strictly for showing to the client in the front-end
@@ -24,6 +25,7 @@ export function getProviderUrl(
case LogProvider.Custom:
case LogProvider.Datadog:
case LogProvider.Cribl:
+ case LogProvider.SumoLogic:
return logStream.credentials.url;
case LogProvider.Splunk:
return `https://${logStream.credentials.hostname}:8088/services/collector/event`;
diff --git a/frontend/src/hooks/api/auditLogStreams/enums.ts b/frontend/src/hooks/api/auditLogStreams/enums.ts
index 63788a5366..53ab71da8b 100644
--- a/frontend/src/hooks/api/auditLogStreams/enums.ts
+++ b/frontend/src/hooks/api/auditLogStreams/enums.ts
@@ -4,7 +4,8 @@ export enum LogProvider {
Custom = "custom",
Datadog = "datadog",
Splunk = "splunk",
- QRadar = "qradar"
+ QRadar = "qradar",
+ SumoLogic = "sumo-logic"
}
export enum StreamMode {
diff --git a/frontend/src/hooks/api/auditLogStreams/types/index.ts b/frontend/src/hooks/api/auditLogStreams/types/index.ts
index 362cb1fbc6..2ecf114711 100644
--- a/frontend/src/hooks/api/auditLogStreams/types/index.ts
+++ b/frontend/src/hooks/api/auditLogStreams/types/index.ts
@@ -6,6 +6,7 @@ import { TDatadogProviderLogStream } from "./providers/datadog-provider";
import { TQRadarProviderLogStream } from "./providers/qradar-provider";
import { TAuditLogStreamFilters } from "./providers/root-provider";
import { TSplunkProviderLogStream } from "./providers/splunk-provider";
+import { TSumoLogicProviderLogStream } from "./providers/sumo-logic-provider";
export type { TAuditLogStreamFilters };
@@ -14,7 +15,8 @@ export type TAuditLogStream =
| TDatadogProviderLogStream
| TSplunkProviderLogStream
| TAzureProviderLogStream
- | TCriblProviderLogStream;
+ | TCriblProviderLogStream
+ | TSumoLogicProviderLogStream;
export type TAuditLogStreamProviderMap = {
[LogProvider.Azure]: TAzureProviderLogStream;
@@ -23,6 +25,7 @@ export type TAuditLogStreamProviderMap = {
[LogProvider.Datadog]: TDatadogProviderLogStream;
[LogProvider.Splunk]: TSplunkProviderLogStream;
[LogProvider.QRadar]: TQRadarProviderLogStream;
+ [LogProvider.SumoLogic]: TSumoLogicProviderLogStream;
};
export type TCreateAuditLogStreamDTO = Pick<TAuditLogStream, "provider" | "credentials"> & {
diff --git a/frontend/src/hooks/api/auditLogStreams/types/providers/sumo-logic-provider.ts b/frontend/src/hooks/api/auditLogStreams/types/providers/sumo-logic-provider.ts
new file mode 100644
index 0000000000..6def41cd0b
--- /dev/null
+++ b/frontend/src/hooks/api/auditLogStreams/types/providers/sumo-logic-provider.ts
@@ -0,0 +1,10 @@
+import { LogProvider } from "../../enums";
+import { TRootProviderLogStream } from "./root-provider";
+
+export type TSumoLogicProviderLogStream = TRootProviderLogStream & {
+ provider: LogProvider.SumoLogic;
+ credentials: {
+ url: string;
+ token?: string;
+ };
+};
diff --git a/frontend/src/pages/organization/AuditLogsPage/components/AuditLogStreamTab/AuditLogStreamForm/AuditLogStreamForm.tsx b/frontend/src/pages/organization/AuditLogsPage/components/AuditLogStreamTab/AuditLogStreamForm/AuditLogStreamForm.tsx
index 203fa341cb..e98b63e8d6 100644
--- a/frontend/src/pages/organization/AuditLogsPage/components/AuditLogStreamTab/AuditLogStreamForm/AuditLogStreamForm.tsx
+++ b/frontend/src/pages/organization/AuditLogsPage/components/AuditLogStreamTab/AuditLogStreamForm/AuditLogStreamForm.tsx
@@ -12,6 +12,7 @@ import { CriblProviderAuditLogStreamForm } from "./CriblProviderAuditLogStreamFo
import { CustomProviderAuditLogStreamForm } from "./CustomProviderAuditLogStreamForm";
import { DatadogProviderAuditLogStreamForm } from "./DatadogProviderAuditLogStreamForm";
import { SplunkProviderAuditLogStreamForm } from "./SplunkProviderAuditLogStreamForm";
+import { SumoLogicProviderAuditLogStreamForm } from "./SumoLogicProviderAuditLogStreamForm";
// Provider forms submit their provider + credentials; the custom form may also submit a
// one-way streamMode upgrade (single -> batch). Every form may submit product filters.
@@ -62,6 +63,8 @@ const CreateForm = ({ provider, onComplete }: CreateFormProps) => {
return <DatadogProviderAuditLogStreamForm onSubmit={onSubmit} />;
case LogProvider.Splunk:
return <SplunkProviderAuditLogStreamForm onSubmit={onSubmit} />;
+ case LogProvider.SumoLogic:
+ return <SumoLogicProviderAuditLogStreamForm onSubmit={onSubmit} />;
default:
throw new Error(`Unhandled Provider: ${provider}`);
}
@@ -104,6 +107,10 @@ const UpdateForm = ({ auditLogStream, onComplete }: UpdateFormProps) => {
return (
<SplunkProviderAuditLogStreamForm onSubmit={onSubmit} auditLogStream={auditLogStream} />
);
+ case LogProvider.SumoLogic:
+ return (
+ <SumoLogicProviderAuditLogStreamForm onSubmit={onSubmit} auditLogStream={auditLogStream} />
+ );
default:
throw new Error(`Unhandled Provider: ${(auditLogStream as TAuditLogStream).provider}`);
}
diff --git a/frontend/src/pages/organization/AuditLogsPage/components/AuditLogStreamTab/AuditLogStreamForm/SumoLogicProviderAuditLogStreamForm.tsx b/frontend/src/pages/organization/AuditLogsPage/components/AuditLogStreamTab/AuditLogStreamForm/SumoLogicProviderAuditLogStreamForm.tsx
new file mode 100644
index 0000000000..2ca26add51
--- /dev/null
+++ b/frontend/src/pages/organization/AuditLogsPage/components/AuditLogStreamTab/AuditLogStreamForm/SumoLogicProviderAuditLogStreamForm.tsx
@@ -0,0 +1,117 @@
+import { Controller, FormProvider, useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+import { z } from "zod";
+
+import { Button, FormControl, Input, ModalClose, SecretInput } from "@app/components/v2";
+import { LogProvider } from "@app/hooks/api/auditLogStreams/enums";
+import { TSumoLogicProviderLogStream } from "@app/hooks/api/auditLogStreams/types/providers/sumo-logic-provider";
+
+import { auditLogStreamFiltersSchema, ProductsField } from "./AuditLogStreamProductsField";
+
+type Props = {
+ auditLogStream?: TSumoLogicProviderLogStream;
+ onSubmit: (formData: FormData) => void;
+};
+
+const formSchema = z.object({
+ provider: z.literal(LogProvider.SumoLogic),
+ credentials: z.object({
+ url: z.string().url().trim().min(1).max(255),
+ token: z.string().trim().max(255).optional()
+ }),
+ ...auditLogStreamFiltersSchema.shape
+});
+
+type FormData = z.infer<typeof formSchema>;
+
+export const SumoLogicProviderAuditLogStreamForm = ({ auditLogStream, onSubmit }: Props) => {
+ const isUpdate = Boolean(auditLogStream);
+
+ const form = useForm<FormData>({
+ resolver: zodResolver(formSchema),
+ defaultValues: auditLogStream ?? {
+ provider: LogProvider.SumoLogic
+ }
+ });
+
+ const {
+ handleSubmit,
+ control,
+ formState: { isSubmitting, isDirty }
+ } = form;
+
+ return (
+ <FormProvider {...form}>
+ <form onSubmit={handleSubmit(onSubmit)}>
+ <Controller
+ name="credentials.url"
+ control={control}
+ shouldUnregister
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ errorText={error?.message}
+ isError={Boolean(error?.message)}
+ label="HTTP Source Address"
+ tooltipText={
+ <>The HTTP Source Address from your Sumo Logic HTTP Logs and Metrics Source.</>
+ }
+ >
+ <Input
+ {...field}
+ placeholder="https://endpoint.collection.sumologic.com/receiver/v1/http"
+ />
+ </FormControl>
+ )}
+ />
+ <Controller
+ name="credentials.token"
+ control={control}
+ shouldUnregister
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ isOptional
+ errorText={error?.message}
+ isError={Boolean(error?.message)}
+ label="Auth Token"
+ tooltipText={
+ <>
+ When set, it is sent as an <code>x-sumo-token</code> header. Use this if you
+ prefer header based authentication; otherwise leave it empty and rely on the token
+ in the URL.
+ </>
+ }
+ >
+ <SecretInput
+ containerClassName="text-gray-400 group-focus-within:border-primary-400/50! border border-mineshaft-500 bg-mineshaft-900 px-2.5 py-1.5"
+ value={value ?? ""}
+ onChange={(e) => onChange(e.target.value)}
+ />
+ </FormControl>
+ )}
+ />
+
+ <div className="mt-6">
+ <ProductsField />
+ </div>
+
+ <div className="mt-8 flex items-center">
+ <Button
+ className="mr-4"
+ size="sm"
+ type="submit"
+ colorSchema="secondary"
+ isLoading={isSubmitting}
+ isDisabled={isSubmitting || !isDirty}
+ >
+ {isUpdate ? "Update Credentials" : "Create Log Stream"}
+ </Button>
+ <ModalClose asChild>
+ <Button colorSchema="secondary" variant="plain">
+ Cancel
+ </Button>
+ </ModalClose>
+ </div>
+ </form>
+ </FormProvider>
+ );
+};