Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
refactor(audit-log): update configuration and improve audit log handling
Victor Hugo dos Santosf7587ba6bdc4
diff --git a/backend/src/ee/services/audit-log/audit-log-dal.ts b/backend/src/ee/services/audit-log/audit-log-dal.tsindex 332fce2455..7ad9233d0c 100644--- a/backend/src/ee/services/audit-log/audit-log-dal.ts+++ b/backend/src/ee/services/audit-log/audit-log-dal.ts@@ -236,7 +236,7 @@ export const auditLogDALFactory = (db: TDbClient) => {const create: TAuditLogDALFactory["create"] = async (tx) => {const config = getConfig();- if (config.DISABLE_AUDIT_LOG_STORAGE) {+ if (config.DISABLE_POSTGRES_AUDIT_LOG_STORAGE) {return {...tx,id: uuidv4(),diff --git a/backend/src/ee/services/audit-log/audit-log-queue.ts b/backend/src/ee/services/audit-log/audit-log-queue.tsindex c0c4fdd6c4..b5ade3eb4a 100644--- a/backend/src/ee/services/audit-log/audit-log-queue.ts+++ b/backend/src/ee/services/audit-log/audit-log-queue.ts@@ -154,7 +154,9 @@ export const auditLogQueueServiceFactory = async ({await auditLogDAL.create(auditLog);}- await auditLogStreamService.streamLog(orgId, auditLog);+ if (getConfig().AUDIT_LOG_STREAMS_ENABLED) {+ await auditLogStreamService.streamLog(orgId, auditLog);+ }}} catch (error) {logger.error(diff --git a/backend/src/ee/services/audit-log/audit-log-service.ts b/backend/src/ee/services/audit-log/audit-log-service.tsindex 724f618829..c24af1519e 100644--- a/backend/src/ee/services/audit-log/audit-log-service.ts+++ b/backend/src/ee/services/audit-log/audit-log-service.ts@@ -9,6 +9,7 @@ import { logger } from "@app/lib/logger";import { ActorType } from "@app/services/auth/auth-type";import { TNotificationServiceFactory } from "@app/services/notification/notification-service";import { NotificationType } from "@app/services/notification/notification-types";+import { TOrgDALFactory } from "@app/services/org/org-dal";import { SmtpTemplates, TSmtpService } from "@app/services/smtp/smtp-service";import { TUserDALFactory } from "@app/services/user/user-dal";@@ -20,8 +21,8 @@ import { TAuditLogDALFactory } from "./audit-log-dal";import { TAuditLogQueueServiceFactory } from "./audit-log-queue";import { ACTOR_TYPE_TO_METADATA_ID_KEY, EventType, TAuditLogServiceFactory } from "./audit-log-types";-const AUDIT_LOG_ROW_WARNING_THRESHOLD = 300_000_000;-const AUDIT_LOG_ALERT_ROW_INCREMENT = 10_000_000;+const AUDIT_LOG_ROW_WARNING_THRESHOLD = 2_000;+const AUDIT_LOG_ALERT_ROW_INCREMENT = 10;type TAuditLogServiceFactoryDep = {auditLogDAL: TAuditLogDALFactory;@@ -31,6 +32,7 @@ type TAuditLogServiceFactoryDep = {keyStore: Pick<TKeyStoreFactory, "getItem" | "setItemWithExpiry">;smtpService: Pick<TSmtpService, "sendMail">;userDAL: Pick<TUserDALFactory, "getUsersByFilter">;+ orgDAL: Pick<TOrgDALFactory, "findAllOrgsByUserId">;notificationService: Pick<TNotificationServiceFactory, "createUserNotifications">;};@@ -42,6 +44,7 @@ export const auditLogServiceFactory = ({keyStore,smtpService,userDAL,+ orgDAL,notificationService}: TAuditLogServiceFactoryDep): TAuditLogServiceFactory => {const listAuditLogs: TAuditLogServiceFactory["listAuditLogs"] = async ({@@ -148,13 +151,13 @@ export const auditLogServiceFactory = ({const appCfg = getConfig();const clickHouseConfigured = Boolean(appCfg.isClickHouseConfigured && appCfg.CLICKHOUSE_AUDIT_LOG_ENABLED);const auditLogGenerationDisabled = Boolean(appCfg.DISABLE_AUDIT_LOG_GENERATION);- const auditLogStorageDisabled = Boolean(appCfg.DISABLE_AUDIT_LOG_STORAGE);+ const postgresAuditLogStorageDisabled = Boolean(appCfg.DISABLE_POSTGRES_AUDIT_LOG_STORAGE);const auditLogRowCount = await auditLogDAL.getApproximateRowCount();return {clickHouseConfigured,auditLogGenerationDisabled,- auditLogStorageDisabled,+ auditLogStorageDisabled: postgresAuditLogStorageDisabled,auditLogRowCount};};@@ -194,7 +197,7 @@ export const auditLogServiceFactory = ({smtpService.sendMail({// eslint-disable-next-line @typescript-eslint/no-unsafe-assignmenttemplate: SmtpTemplates.AuditLogMigrationAlert,- subjectLine: "Action recommended: Audit log storage is large",+ subjectLine: "Action recommended: Optimize your audit log storage",recipients: [admin.email],substitutions: {siteUrl: appCfg.SITE_URL@@ -208,15 +211,25 @@ export const auditLogServiceFactory = ({logger.error({ failedCount: failedEmails.length }, "Failed to send some audit log migration alert emails");}+ const adminOrgMap = new Map<string, string>();+ await Promise.all(+ superAdminsResult.users.map(async (admin: TUsers) => {+ const orgs = await orgDAL.findAllOrgsByUserId(admin.id);+ if (orgs.length > 0) {+ adminOrgMap.set(admin.id, orgs[0].id);+ }+ })+ );+await notificationService.createUserNotifications(superAdminsResult.users.map((admin: TUsers) => ({userId: admin.id,// eslint-disable-next-line @typescript-eslint/no-unsafe-assignmenttype: NotificationType.AUDIT_LOG_MIGRATION_RECOMMENDED,- title: "Audit log migration recommended",- body: "Your audit log table has grown large. Consider configuring ClickHouse as your audit log storage backend to maintain query performance.",- link: "/admin/audit-logs"+ title: "Optimize your audit log storage",+ body: "Your audit log volume is growing. To keep searches fast and reduce database load, we recommend streaming logs to an external destination like Splunk or using the built-in ClickHouse integration.",+ link: adminOrgMap.has(admin.id) ? `/organizations/${adminOrgMap.get(admin.id)}/audit-logs` : undefined}))).catch((error) => {diff --git a/backend/src/lib/config/env.ts b/backend/src/lib/config/env.tsindex 8351beb41c..744f8507d0 100644--- a/backend/src/lib/config/env.ts+++ b/backend/src/lib/config/env.ts@@ -131,10 +131,12 @@ const envSchema = zz.string().optional().default("audit_logs").describe("ClickHouse table name for audit logs")),CLICKHOUSE_AUDIT_LOG_ENABLED: zodStrBool.default("true").describe("Enable inserting audit logs into ClickHouse"),- CLICKHOUSE_AUDIT_LOG_QUERY_ENABLED: zodStrBool+ AUDIT_LOG_STREAMS_ENABLED: zodStrBool.default("true").describe("Enable sending audit logs to external log streams"),+ DISABLE_AUDIT_LOG_STORAGE: zodStrBool.optional(), // deprecated: use DISABLE_POSTGRES_AUDIT_LOG_STORAGE instead+ DISABLE_POSTGRES_AUDIT_LOG_STORAGE: zodStrBool.default("false")- .describe("Enable querying audit logs from ClickHouse instead of Postgres"),- DISABLE_AUDIT_LOG_STORAGE: zodStrBool.default("false").optional().describe("Disable audit log storage"),+ .optional()+ .describe("Disable PostgreSQL audit log storage"),GENERATE_SANITIZED_SCHEMA: zodStrBool.default("false").describe("Generate sanitized schema with views after migrations"),@@ -462,6 +464,8 @@ const envSchema = z.transform((data) => ({...data,SALT_ROUNDS: data.SALT_ROUNDS || data.BCRYPT_SALT_ROUND || 12,+ DISABLE_POSTGRES_AUDIT_LOG_STORAGE:+ data.DISABLE_POSTGRES_AUDIT_LOG_STORAGE || data.DISABLE_AUDIT_LOG_STORAGE || false,DB_READ_REPLICAS: data.DB_READ_REPLICAS? databaseReadReplicaSchema.parse(JSON.parse(data.DB_READ_REPLICAS)): undefined,@@ -656,8 +660,8 @@ export const overwriteSchema: {name: "Audit Logs",fields: [{- key: "DISABLE_AUDIT_LOG_STORAGE",- description: "Disable audit log storage"+ key: "DISABLE_POSTGRES_AUDIT_LOG_STORAGE",+ description: "Disable PostgreSQL audit log storage"}]},diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.tsindex d6d5339d68..e693011522 100644--- a/backend/src/server/routes/index.ts+++ b/backend/src/server/routes/index.ts@@ -830,6 +830,7 @@ export const registerRoutes = async (keyStore,smtpService,userDAL,+ orgDAL,notificationService});const secretApprovalPolicyService = secretApprovalPolicyServiceFactory({@@ -3253,7 +3254,7 @@ export const registerRoutes = async (redisConfigured: cfg.isRedisConfigured,secretScanningConfigured: cfg.isSecretScanningConfigured,samlDefaultOrgSlug: cfg.samlDefaultOrgSlug,- auditLogStorageDisabled: Boolean(cfg.DISABLE_AUDIT_LOG_STORAGE)+ auditLogStorageDisabled: Boolean(cfg.DISABLE_POSTGRES_AUDIT_LOG_STORAGE)};}});diff --git a/backend/src/services/smtp/emails/AuditLogMigrationAlertTemplate.tsx b/backend/src/services/smtp/emails/AuditLogMigrationAlertTemplate.tsxindex 31b29bb340..ab683a7d67 100644--- a/backend/src/services/smtp/emails/AuditLogMigrationAlertTemplate.tsx+++ b/backend/src/services/smtp/emails/AuditLogMigrationAlertTemplate.tsx@@ -1,36 +1,37 @@import { Heading, Section, Text } from "@react-email/components";+import { BaseButton } from "./BaseButton";import { BaseEmailWrapper, BaseEmailWrapperProps } from "./BaseEmailWrapper";-import { BaseLink } from "./BaseLink";type AuditLogMigrationAlertTemplateProps = Omit<BaseEmailWrapperProps, "title" | "preview" | "children">;export const AuditLogMigrationAlertTemplate = ({ siteUrl }: AuditLogMigrationAlertTemplateProps) => {return (<BaseEmailWrapper- title="Action recommended: Audit log storage is large"- preview="Your audit log table has grown to a size that may impact query performance."+ title={`Action Recommended\nOptimize your audit log storage`}+ preview="Your audit log volume is growing. Stream logs externally or use ClickHouse to keep searches fast."siteUrl={siteUrl}><Heading className="text-black text-[18px] leading-[28px] text-center font-normal p-0 mx-0">- Action Recommended: Audit Log Storage is Large+ Action Recommended+ <br />+ Optimize your audit log storage</Heading><Section className="px-[24px] mt-[36px] pt-[12px] pb-[8px] border border-solid border-gray-200 rounded-md bg-gray-50"><Text className="text-black text-[14px] leading-[24px]">- Your Infisical audit log table has grown to a size where PostgreSQL analytical queries will degrade over time- regardless of hardware tier.- </Text>- <Text className="text-black text-[14px] leading-[24px]">- To maintain query performance and reduce storage costs, we recommend configuring ClickHouse as your audit log- storage backend. ClickHouse provides columnar storage with superior compression and query performance- optimized for audit log analytics at scale.- </Text>- <Text className="text-black text-[14px] leading-[24px]">- Learn more:{" "}- <BaseLink href={`${siteUrl}/docs/documentation/platform/audit-logs-clickhouse-setup`}>- ClickHouse Setup Guide- </BaseLink>+ Your audit log volume is growing. To keep searches fast and reduce database load, we recommend streaming logs+ to an external destination like Splunk or using the built-in ClickHouse integration.</Text>+ <Section className="text-center mt-[16px]">+ <BaseButton href={`${siteUrl}/docs/documentation/platform/audit-log-streams/audit-log-streams`}>+ Set Up Audit Log Streams+ </BaseButton>+ </Section>+ <Section className="text-center mt-[8px]">+ <BaseButton href={`${siteUrl}/docs/documentation/platform/audit-logs-clickhouse-setup`}>+ View ClickHouse Setup Guide+ </BaseButton>+ </Section></Section></BaseEmailWrapper>);diff --git a/docs/documentation/platform/audit-log-streams/audit-log-streams.mdx b/docs/documentation/platform/audit-log-streams/audit-log-streams.mdxindex ad030ec26a..810d11e995 100644--- a/docs/documentation/platform/audit-log-streams/audit-log-streams.mdx+++ b/docs/documentation/platform/audit-log-streams/audit-log-streams.mdx@@ -11,6 +11,20 @@ description: "Learn how to stream Infisical Audit Logs to external logging proviInfisical Audit Log Streaming enables you to transmit your organization's audit logs to external logging providers for monitoring and analysis.+### Disabling PostgreSQL Audit Log Storage++If you're using audit log streams as your primary log destination and don't need audit logs stored in PostgreSQL, you can disable PostgreSQL audit log storage by setting the following environment variable:++```bash+DISABLE_POSTGRES_AUDIT_LOG_STORAGE=true+```++This prevents audit logs from being written to PostgreSQL while still streaming them to all configured log stream destinations. If you're also using [ClickHouse](/documentation/platform/audit-logs-clickhouse-setup), logs will continue to be inserted into ClickHouse as well.++<Info>+ See the [environment variables reference](/self-hosting/configuration/envars) for all available audit log configuration options.+</Info>+## Overview<Steps>@@ -259,7 +273,7 @@ Infisical Audit Log Streaming enables you to transmit your organization's audit- Click on **New Token** in the top left.+ Click on **New Token** in the top right.diff --git a/docs/documentation/platform/audit-logs-clickhouse-setup.mdx b/docs/documentation/platform/audit-logs-clickhouse-setup.mdxindex 9978924a8f..b2472ac2eb 100644--- a/docs/documentation/platform/audit-logs-clickhouse-setup.mdx+++ b/docs/documentation/platform/audit-logs-clickhouse-setup.mdx@@ -14,152 +14,61 @@ For high-volume audit log workloads, ClickHouse provides significant advantages- **Superior compression**: ClickHouse's [columnar storage](https://clickhouse.com/docs/en/intro#why-columnar-databases-are-better-suited-for-olap) significantly reduces disk footprint compared to PostgreSQL's row-oriented storage.- **Query performance**: Analytical queries with complex filters and aggregations are substantially faster due to ClickHouse's vectorized execution engine.-At high row counts, PostgreSQL analytical queries with JSON filter predicates begin to degrade regardless of hardware tier. ClickHouse is purpose-built for this scale.-## Prerequisites-1. A running ClickHouse instance (version 21.3+). See [ClickHouse deployment documentation](https://clickhouse.com/docs/en/install) for installation options.+1. A running ClickHouse instance. See [ClickHouse deployment documentation](https://clickhouse.com/docs/en/install) for installation options.2. A database created in ClickHouse for audit logs.3. Network connectivity from your Infisical backend to the ClickHouse instance.## Configuration-Set the following environment variables in your Infisical backend configuration:+Set the `CLICKHOUSE_URL` environment variable in your Infisical backend configuration:```bash-# Required: ClickHouse connection URL-CLICKHOUSE_URL=http://username:password@clickhouse-host:8123/database_name--# Optional: Enable audit log writes to ClickHouse (default: true)-CLICKHOUSE_AUDIT_LOG_ENABLED=true--# Optional: Enable reading audit logs from ClickHouse instead of Postgres (default: false)-CLICKHOUSE_AUDIT_LOG_QUERY_ENABLED=false--# Optional: Disable audit log writes to PostgreSQL (default: false)-DISABLE_AUDIT_LOG_STORAGE=false-```--### Connection URL Format--The `CLICKHOUSE_URL` follows this format:-```-http(s)://username:password@host:port/database+CLICKHOUSE_URL=http(s)://username:password@host:port/database```Example:-```+```bashCLICKHOUSE_URL=http://infisical:[email protected]:8123/audit_logs```-### Table Name (Optional)--By default, Infisical uses the `audit_logs` table in ClickHouse. Override with:+That's all that's needed — ClickHouse audit log writes are enabled by default once the URL is set. To customize the table name (default: `audit_logs`):```bashCLICKHOUSE_AUDIT_LOG_TABLE_NAME=custom_audit_logs```-## How It Works+For the full list of available ClickHouse and audit log environment variables (insert settings, table engine, disabling PostgreSQL storage, etc.), see the [Environment Variables Reference](/self-hosting/configuration/envars#clickhouse-optional).-Once configured, Infisical automatically:+## How It Works-1. **Async batch writes**: Audit events are queued in Redis and batch-inserted into ClickHouse every 5 seconds via a background worker.-2. **Automatic schema creation**: On first startup, Infisical creates the audit log table in ClickHouse with an optimized schema (partitioned by day, primary key on `orgId`, `projectId`, `createdAt`).-3. **Dual-write mode**: Audit logs continue writing to PostgreSQL (for backward compatibility) unless you set `DISABLE_AUDIT_LOG_STORAGE=true`.-4. **Query routing**: When `CLICKHOUSE_AUDIT_LOG_QUERY_ENABLED=true`, the audit log API automatically reads from ClickHouse instead of PostgreSQL.+Once `CLICKHOUSE_URL` is set, audit log writes switch from PostgreSQL to ClickHouse. Events are queued in a Redis stream and batch-inserted into ClickHouse every 5 seconds via a background worker. Reads also route to ClickHouse automatically. On first startup, Infisical creates the ClickHouse table if it doesn't already exist.### Migration Strategy**Recommended approach for existing deployments:**-1. **Phase 1** — Enable writes only:+<Warning>+Enabling ClickHouse is a hard cutover. All reads immediately route to ClickHouse — the application will no longer query PostgreSQL for audit logs. Any historical data that has not been migrated to ClickHouse first will be invisible in the UI until it is migrated. The data is not deleted from PostgreSQL, but the application will not read from it while ClickHouse is enabled.+</Warning>++1. **Phase 1** — Migrate historical data (recommended):+ - Before switching, bulk-load existing audit logs from PostgreSQL into ClickHouse to avoid a visibility gap++2. **Phase 2** — Enable ClickHouse:- Set `CLICKHOUSE_URL` and `CLICKHOUSE_AUDIT_LOG_ENABLED=true`- - Keep `CLICKHOUSE_AUDIT_LOG_QUERY_ENABLED=false`- - New audit logs write to both PostgreSQL and ClickHouse- - Queries continue using PostgreSQL--2. **Phase 2** — Historical data migration (optional):- - Use the `clickhouse-client` CLI to bulk-load historical audit logs from PostgreSQL into ClickHouse- - Example: `INSERT INTO audit_logs SELECT * FROM postgresql('host:5432', 'db', 'audit_logs', 'user', 'password')`--3. **Phase 3** — Switch reads:- - Set `CLICKHOUSE_AUDIT_LOG_QUERY_ENABLED=true`- - Queries now use ClickHouse- - Monitor for any issues--4. **Phase 4** — Cleanup (optional):- - Once confident ClickHouse is working correctly, prune old PostgreSQL audit logs or set `DISABLE_AUDIT_LOG_STORAGE=true` to stop PostgreSQL writes entirely--## Docker Compose Example--Add a ClickHouse service to your `docker-compose.yml`:--```yaml-services:- clickhouse:- image: clickhouse/clickhouse-server:24-alpine- restart: unless-stopped- environment:- CLICKHOUSE_DB: infisical_audit- CLICKHOUSE_USER: infisical- CLICKHOUSE_PASSWORD: changeme- CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: 1- ports:- - "8123:8123"- - "9000:9000"- volumes:- - clickhouse-data:/var/lib/clickhouse- ulimits:- nofile:- soft: 262144- hard: 262144-- backend:- # ... existing backend config- environment:- # ... existing env vars- CLICKHOUSE_URL: http://infisical:changeme@clickhouse:8123/infisical_audit- CLICKHOUSE_AUDIT_LOG_ENABLED: true- # Optional: switch reads to ClickHouse after historical data is migrated- # CLICKHOUSE_AUDIT_LOG_QUERY_ENABLED: true- depends_on:- - clickhouse--volumes:- clickhouse-data:-```+ - New audit logs write to ClickHouse and all queries read exclusively from ClickHouse+ - PostgreSQL audit log writes stop automatically++3. **Phase 3** — Cleanup (optional):+ - Once confident ClickHouse is working correctly, prune old PostgreSQL audit log data## VerificationAfter configuration, verify ClickHouse integration:-1. **Check backend logs** on startup for ClickHouse connection success-2. **Perform an action** in Infisical (e.g., read a secret)-3. **Query ClickHouse directly**:--```sql-SELECT count() FROM audit_logs;-SELECT * FROM audit_logs ORDER BY createdAt DESC LIMIT 10;-```+1. **Perform an action** in Infisical (e.g., read a secret)+2. **Query ClickHouse directly** to confirm rows are being insertedIf rows appear in ClickHouse, the integration is working correctly.--## Troubleshooting--### Connection Errors--- Verify network connectivity: `curl http://clickhouse-host:8123/ping`-- Check credentials in `CLICKHOUSE_URL`-- Ensure the database exists in ClickHouse--### No Data in ClickHouse--- Check backend logs for batch insert errors-- Verify `CLICKHOUSE_AUDIT_LOG_ENABLED=true`-- Ensure Redis is configured (required for the audit log queue)--### Slow Queries in ClickHouse--- Verify the table was created with proper partitioning and primary key (Infisical creates this automatically on first run)-- Check ClickHouse query logs: `SELECT query, query_duration_ms FROM system.query_log ORDER BY event_time DESC LIMIT 10;`diff --git a/docs/self-hosting/configuration/envars.mdx b/docs/self-hosting/configuration/envars.mdxindex 9d2dc09537..7b523cde4a 100644--- a/docs/self-hosting/configuration/envars.mdx+++ b/docs/self-hosting/configuration/envars.mdx@@ -70,11 +70,6 @@ Example values:auth method.</ParamField>-<ParamField query="DISABLE_AUDIT_LOG_STORAGE" type="string" default="false">- Disable storing audit logs in the database. This is useful if you're using- audit log streams and don't want to store them in the database.-</ParamField>-## CORSCross-Origin Resource Sharing (CORS) is a security feature that allows web applications running on one domain to access resources from another domain.@@ -158,6 +153,56 @@ DB_READ_REPLICAS=[{"DB_CONNECTION_URI":""}]</Expandable></ParamField>+### Audit Log PostgreSQL (Optional)++<ParamField query="AUDIT_LOGS_DB_CONNECTION_URI" type="string" optional>+ Separate PostgreSQL connection string for audit log storage. If not set, audit logs are stored in the main database.+</ParamField>++<ParamField query="AUDIT_LOGS_DB_ROOT_CERT" type="string" optional>+ Base64-encoded CA certificate for the audit log PostgreSQL database connection. Only needed if `AUDIT_LOGS_DB_CONNECTION_URI` is set.+</ParamField>++### ClickHouse (Optional)++ClickHouse can be used as an alternative audit log storage backend for high-volume deployments. See the [ClickHouse Setup Guide](/documentation/platform/audit-logs-clickhouse-setup) for more details.++<ParamField query="CLICKHOUSE_URL" type="string" optional>+ ClickHouse connection URL. Example: `http://user:password@host:8123/database`+</ParamField>++<ParamField query="CLICKHOUSE_AUDIT_LOG_ENABLED" type="string" default="true">+ Enable inserting audit logs into ClickHouse. Defaults to `true` when `CLICKHOUSE_URL` is set.+</ParamField>++<ParamField query="CLICKHOUSE_AUDIT_LOG_TABLE_NAME" type="string" default="audit_logs">+ ClickHouse table name for audit logs.+</ParamField>++<ParamField query="CLICKHOUSE_AUDIT_LOG_ENGINE" type="string" default="ReplacingMergeTree">+ ClickHouse engine for the audit logs table, used during table creation. Example: `ReplacingMergeTree` or `SharedReplacingMergeTree('/clickhouse/tables/{uuid}/{shard}', '{replica}')`.+</ParamField>++<ParamField query="CLICKHOUSE_AUDIT_LOG_INSERT_SETTINGS" type="string" optional>+ ClickHouse insert settings as a JSON string. Applied when inserting audit logs.++ Default: `{"async_insert":1,"wait_for_async_insert":0,"date_time_input_format":"best_effort"}`+</ParamField>++### Audit Log Behavior++<ParamField query="DISABLE_POSTGRES_AUDIT_LOG_STORAGE" type="string" default="false">+ Disable storing audit logs in PostgreSQL. When set to `true`, audit logs are not written to PostgreSQL but are still sent to ClickHouse (if configured) and any configured [audit log streams](/documentation/platform/audit-log-streams/audit-log-streams).+</ParamField>++<ParamField query="AUDIT_LOG_STREAMS_ENABLED" type="string" default="true">+ Enable sending audit logs to external [audit log streams](/documentation/platform/audit-log-streams/audit-log-streams). When set to `false`, no events are sent to configured stream destinations, but PostgreSQL and ClickHouse storage are unaffected.+</ParamField>++<ParamField query="DISABLE_AUDIT_LOG_GENERATION" type="string" default="false">+ Disable audit log generation entirely. When set to `true`, no audit log events are produced — neither PostgreSQL, ClickHouse, nor audit log streams will receive events.+</ParamField>+### RedisRedis is used for caching and background tasks. You can use either a standalone Redis instance, Redis Sentinel, or Redis Cluster setup.diff --git a/frontend/src/pages/organization/AuditLogsPage/components/LogsSection.tsx b/frontend/src/pages/organization/AuditLogsPage/components/LogsSection.tsxindex c95ea95c2c..e845153029 100644--- a/frontend/src/pages/organization/AuditLogsPage/components/LogsSection.tsx+++ b/frontend/src/pages/organization/AuditLogsPage/components/LogsSection.tsx@@ -55,7 +55,7 @@ const LogsSectionComponent = ({const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["upgradePlan"] as const);const { data: migrationStatus } = useGetAuditLogMigrationStatus();- const AUDIT_LOG_ROW_WARNING_THRESHOLD = 300_000_000;+ const AUDIT_LOG_ROW_WARNING_THRESHOLD = 2_000;const showClickHouseWarning =migrationStatus &&!migrationStatus.clickHouseConfigured &&@@ -104,20 +104,29 @@ const LogsSectionComponent = ({return (<div className="w-full rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">{showClickHouseWarning && (- <UnstableAlert variant="info" className="mb-4">+ <UnstableAlert variant="warning" className="mb-4"><UnstableAlertDescription><p>- Your audit log table is growing large. PostgreSQL performance will degrade over time- at this scale. Consider configuring{" "}+ Your audit log volume is growing. To keep searches fast and reduce database load, we+ recommend streaming logs to an{" "}<a- href="https://infisical.com/docs/documentation/platform/audit-logs-clickhouse-setup"+ href="https://infisical.com/docs/documentation/platform/audit-log-streams/audit-log-streams"target="_blank"rel="noopener noreferrer"className="underline underline-offset-2 hover:opacity-80">- ClickHouse+ external destination</a>{" "}- as your audit log storage backend to maintain query performance.+ like Splunk or using the built-in{" "}+ <a+ href="https://infisical.com/docs/documentation/platform/audit-logs-clickhouse-setup"+ target="_blank"+ rel="noopener noreferrer"+ className="underline underline-offset-2 hover:opacity-80"+ >+ ClickHouse integration+ </a>+ .</p></UnstableAlertDescription></UnstableAlert>