Skip to Content
better-auth-plugins

Audit log

A log of sign-ins, account changes, and admin actions.

The audit log plugin records security-relevant events: who signed in, how, from where, and what changed on their account. Users can see their own history; admins can see everyone's.

  • Records every sign-in method (email, social, magic link, OTP, two-factor, ...) and failed sign-ins, without ever storing passwords or tokens.
  • Records sign-ups, sign-outs, revoked sessions, password and email changes, linked accounts, deleted users, and the actions of better-auth's admin plugin, with the admin as the actor.
  • Events outlive the users they mention, user-deleted included.
  • Optional hash chain that shows when events were changed or deleted.
  • Pluggable: change or drop events with beforeLog, send them to a SIEM, a log service, or a webhook with destinations, store them elsewhere with storage, delete old ones with retention.

Installation

Install the package

npm install @checodo/better-auth-audit-log

Add the plugin to your auth config

Add it after your other plugins. Plugins such as twoFactor finish a sign-in in their own hooks, and the audit log needs to see the result (only nextCookies() goes after it). The plugin warns at startup if it comes before twoFactor.

auth.ts
import { betterAuth } from "better-auth";
import { admin, twoFactor } from "better-auth/plugins";
import { auditLog } from "@checodo/better-auth-audit-log";

export const auth = betterAuth({
  plugins: [
    admin(),
    twoFactor(),
    auditLog({ retention: { days: 90 } }),
  ],
});

Migrate the database

The plugin adds the auditEvent table, and auditChain with the hash chain (see Schema). With custom storage, there is no table.

npx auth@latest migrate

Add the client plugin

auth-client.ts
import { createAuthClient } from "better-auth/client";
import { auditLogClient } from "@checodo/better-auth-audit-log/client";

export const authClient = createAuthClient({
  plugins: [auditLogClient()],
});

Usage

Events

Each event has a type, a status (success or failure), a severity, the user it is about (userId) and the user who did it (actorUserId): the user themselves, an admin, or nobody (a failed sign-in).

TypeRecorded whenSeverity
sign-upA user is created, by any method. metadata.method: email, github, admin, ...low
sign-inA session is created by signing in, by any method. metadata.method as abovelow
sign-in (failure)Email, username, phone number, email OTP, or two-factor sign-in fails. metadata.identifier: see Failed sign-insmedium
sign-outThe user signs outlow
session-revokedThe user revokes a session, all sessions, or the other sessions (metadata.scope)medium
password-changedThe user changes their passwordmedium
password-resetThe user resets their password with a reset link, an email OTP, or a phone number OTPmedium
email-changedThe user's email changes through any endpoint (change email, its verification link, an admin update, ...). metadata.email is the new onemedium
email-verifiedThe user verifies their email with a link or an OTPlow
account-linkedAn account (metadata.providerId) is linked to an existing usermedium
account-unlinkedThe user unlinks an accountmedium
two-factor-enabledThe user turns two-factor on (two-factor plugin), when the first code is verifiedmedium
two-factor-disabledThe user turns two-factor offhigh
user-deletedA user is deleted, by themselves or an adminhigh
admin.<action>An admin plugin action: create-user, update-user, set-role, set-user-password, ban-user, unban-user, impersonate-user, stop-impersonating, revoke-user-session, revoke-user-sessions, remove-userhigh; set-role, set-user-password, impersonate-user critical
organization.<action>An organization plugin action, see Organizationslow to high

A few details:

  • A sign-up that signs the user in records sign-up and sign-in.
  • A two-factor sign-in is recorded once, when the second factor is verified (metadata.method: "two-factor").
  • New session cookies for a user who is already signed in (password change, enabling two-factor, impersonation) aren't sign-ins.
  • Admin actions are recorded on failure too, e.g. a user who isn't an admin trying to change roles, with the error code.
  • The first account of a new user (the password of an email sign-up, the GitHub account of a GitHub sign-up) is part of the sign-up, not an account-linked. "First" means created within 10 seconds of the user, in practice the same request; an account linked faster than that after signing up isn't recorded as account-linked.
  • Database changes made by your own server code outside a request (for example internalAdapter.updateUser) aren't recorded, except sign-ups, deleted users, and linked accounts.
  • Every event can have the sessionId, the session's active organizationId (organization plugin), the IP address, and the user agent.

Organizations

With better-auth's organization plugin, these are recorded too, on success and on failure (a member who may not change roles trying to, with the error code). organizationId is the organization the action is about; actorUserId is who did it.

TypeRecorded whenuserIdmetadataSeverity
organization.created/organization/createthe creatorname, sluglow
organization.updated/organization/updatethe actorfields changedlow
organization.deleted/organization/deletethe actor-high
organization.invitation-created/organization/invite-memberthe inviterinvitationId, email, rolelow
organization.invitation-accepted/organization/accept-invitationthe new memberinvitationId, memberId, rolelow
organization.invitation-rejected/organization/reject-invitationthe inviteeinvitationIdlow
organization.invitation-canceled/organization/cancel-invitationthe actorinvitationId, emaillow
organization.member-role-changed/organization/update-member-rolethe membermemberId, rolehigh
organization.member-removed/organization/remove-memberthe removed membermemberIdmedium
organization.member-left/organization/leavethe member-low

auth.api.addMember is server-only (it has no URL), so hooks never see it: record it yourself with recordAuditEvent if you need it.

Failed sign-ins

A failed sign-in is recorded with its error code, for the user whose email (or username, or phone number) was entered, so users see attempts on their account. Passwords are never stored, and because people sometimes type their password into the email or username field, the entered value is only kept as metadata.identifier when it is clearly an identifier: a well-formed email address or phone number, or the username of an existing user.

better-auth's rate limiter, on in production by default, allows 3 sign-in requests per 10 seconds per IP address, which also limits how fast failed attempts can fill the log.

Your events

Signed-in users list their own events, newest first:

const { data } = await authClient.auditLog.listEvents({
  query: {
    type: "sign-in", // all optional
    status: "failure",
    from: new Date(Date.now() - 30 * 86_400_000),
    limit: 20,
    offset: 0,
  },
});
// data: { events: [{ id, type, status, severity, ipAddress, userAgent, createdAt, ... }], total }

That makes a "recent activity" page easy: where and when the account was used, and failed attempts to sign in to it.

Users only see the IP address, user agent, and session of what they did themselves. For events someone else caused on their account (an admin banning them, a failed sign-in with their email), those fields are null in their list; admins see them.

Your own events

Record events of your app with the server-only recordAuditEvent. It has no HTTP route, so clients can't write to the log:

server
await auth.api.recordAuditEvent({
  body: {
    type: "billing.plan-changed", // letters, digits, ".", "-", "_"
    userId: user.id,
    actorUserId: user.id,
    severity: "medium", // optional
    metadata: { from: "free", to: "pro" }, // optional, up to 4,000 characters of JSON
  },
  headers: request.headers, // optional: records the IP address and user agent
});
// { event } (or { event: null } if `events` or `beforeLog` dropped it)

To record other endpoints, map their paths to event types with paths. The signed-in user is the event's user and actor:

auth.ts
auditLog({
  paths: {
    "/organization/delete": "organization.deleted",
    "/api-key/create": "api-key.created",
  },
});

Events from other plugins

This repository's other plugins record their events in the audit log when you use it; nothing to configure. They find it the way better-auth's own plugins find each other (ctx.context.getPlugin("audit-log")), so they don't depend on it.

TypePluginRecorded whenSeverity
blocklist.blockedBlocklistA sign-up, sign-in, or change is refused (status: "failure"). metadata: target, the value, and the rule (both values "[redacted]" for passwords)medium
blocklist.rule-createdBlocklistAn admin creates a rulehigh
blocklist.rule-deletedBlocklistAn admin deletes a rulehigh
normalize.email-alias-refusedNormalizeA second account for an inbox is refused (status: "failure", no actor, userId: the existing account). metadata.email: the address triedmedium
referral.createdReferralA user signs up with a referral code (userId: the new user)low
referral.completedReferralA referral completes (userId: the referrer it rewards)medium
referral.reward-failedReferralonReferralCompleted threw on its last attempt (rewardRetry.maxAttempts), so the reward isn't retried (status: "failure", no actor, userId: the referrer). metadata: referralId, referredUserId, attemptshigh
waitlist.confirmedWaitlistSomeone confirms their email through the link (no actor). metadata.emaillow
waitlist.approvedWaitlistAn entry is approved, by an admin or autoApprove (no actor). metadata.emailmedium
waitlist.rejectedWaitlistAn admin rejects an entrymedium
waitlist.entry-deletedWaitlistAn admin deletes an entrymedium
waitlist.leftWaitlistSomeone leaves the waitlist through the link (no actor); the entry is deleted. metadata.emaillow

A sign-up the blocklist refuses during a social sign-in is still recorded: better-auth creates social users in a database transaction, which the refusal rolls back, so the event is written after the transaction instead.

Your own plugins can do the same with the plugin's recordEvent. It fills in the signed-in user as actor, the session, the IP address, and the user agent from the current request, and never throws:

my-plugin.ts
await ctx.context.getPlugin("audit-log")?.recordEvent({
  type: "my-plugin.thing-done",
  userId: user.id,
  metadata: { thingId },
});

Which events

Record a subset with events; group.* matches every type of a group:

auth.ts
auditLog({
  events: ["sign-in", "password-changed", "admin.*"],
  severity: { "sign-in": "medium" }, // override the built-in severities
});

Privacy

Audit logs hold personal data: IP addresses, user agents, emails. Mention them in your privacy policy and keep them only as long as you need (see Retention).

  • Metadata keys that look like secrets (password, token, secret, apiKey, otp, ...) are always replaced with [redacted].
  • captureIp: false and captureUserAgent: false turn either off.
  • Events are kept when a user is deleted, so the log still shows what happened. To honor an erasure request, delete the rows whose userId or actorUserId is that user (or pseudonymize them) in the auditEvent table. With the hash chain, verification then reports those events; keep a note of which ones you erased.
  • User agents and metadata are whatever the client sent: escape them when you display them (React does this for you).
  • beforeLog changes or drops an event before it is stored, for example to shorten IP addresses:
auth.ts
auditLog({
  beforeLog: (event) => {
    if (event.type === "sign-out") return null; // drop
    return { ...event, ipAddress: event.ipAddress?.replace(/\.\d+$/, ".0") ?? null };
  },
});

The IP address follows better-auth's advanced.ipAddress rules: the ipAddressHeaders you configure (default x-forwarded-for), trustedProxies, and disableIpTracking. Like the IP address better-auth stores on sessions, an IPv6 address is shortened to its network (ipv6Subnet, default 64 bits, so 2001:db8::1 is stored as 2001:0db8:0000:0000:0000:0000:0000:0000). Set ipv6Subnet: 128 to keep full addresses, which also makes rate limiting count each IPv6 address separately.

Forwarding events

destinations sends every stored event to more places besides the auditEvent table: a SIEM, a log service, a webhook. Each destination has a name (for logged errors) and a send function that always gets an array of events:

auth.ts
auditLog({
  destinations: [
    {
      name: "alerts",
      events: ["sign-in", "admin.*"], // optional, like the plugin's `events`
      send: async (batch) => {
        for (const event of batch) {
          if (event.severity === "critical") await alertSecurityTeam(event);
        }
      },
    },
  ],
});

httpDestination and consoleDestination, from @checodo/better-auth-audit-log/destinations, cover the common cases without a vendor SDK:

auth.ts
import { consoleDestination, httpDestination } from "@checodo/better-auth-audit-log/destinations";

auditLog({
  destinations: [
    httpDestination({
      name: "siem",
      url: "https://siem.example.com/intake",
      headers: { authorization: `Bearer ${process.env.SIEM_TOKEN}` },
      format: "ndjson", // or "json": one array per request (the default)
      batch: { size: 100, wait: 2000 },
    }),
    // One JSON line per event on stdout, for development.
    consoleDestination(),
  ],
});

With secret, httpDestination signs every request the Standard Webhooks way (webhook-id, webhook-timestamp, and webhook-signature headers), so the receiver can check it with any Standard Webhooks library. The secret is a base64 key of 24 to 64 bytes, optionally prefixed with whsec_. A response other than 2xx counts as failed, and so does a redirect: it is not followed, so the events and your headers never go to a URL you didn't configure.

Receiving signed requests. Create the secret once, for example with openssl rand -base64 32, and give the same value to httpDestination and to the receiver. The receiver checks three things before it trusts a request: the timestamp is recent (so an old request can't be replayed), the signature matches the exact body it received, and it hasn't seen the webhook-id before. A Standard Webhooks library does the first two; with Web Crypto alone it looks like this:

app/api/audit-webhook/route.ts
import type { AuditEvent } from "@checodo/better-auth-audit-log";

/** How old a request may be, in seconds. */
const TOLERANCE = 5 * 60;

const fromBase64 = (value: string) => Uint8Array.from(atob(value), (char) => char.charCodeAt(0));

/** The events of a request signed by `httpDestination`, or `null` if it isn't genuine. */
async function verifiedEvents(request: Request, secret: string): Promise<AuditEvent[] | null> {
  const id = request.headers.get("webhook-id");
  const timestamp = request.headers.get("webhook-timestamp");
  const signatures = request.headers.get("webhook-signature");
  if (!id || !timestamp || !signatures) return null;
  if (Math.abs(Date.now() / 1000 - Number(timestamp)) > TOLERANCE) return null;

  // The exact body: parsing and serializing again would change the bytes.
  const body = await request.text();
  try {
    const key = await crypto.subtle.importKey(
      "raw",
      fromBase64(secret.startsWith("whsec_") ? secret.slice(6) : secret),
      { name: "HMAC", hash: "SHA-256" },
      false,
      ["verify"],
    );
    const signed = new TextEncoder().encode(`${id}.${timestamp}.${body}`);
    // "v1,<signature>", several separated by spaces while a secret is rotated.
    for (const entry of signatures.split(" ")) {
      const [version, signature] = entry.split(",");
      if (version !== "v1" || !signature) continue;
      // `verify` compares in constant time.
      if (await crypto.subtle.verify("HMAC", key, fromBase64(signature), signed)) {
        return JSON.parse(body) as AuditEvent[]; // format: "json"; "ndjson" is one event per line
      }
    }
  } catch {
    return null; // a malformed signature or body
  }
  return null;
}

export async function POST(request: Request) {
  const events = await verifiedEvents(request, process.env.AUDIT_WEBHOOK_SECRET ?? "");
  if (!events) return new Response("Invalid signature", { status: 401 });
  // Skip a `webhook-id` you have already processed, then store the events.
  await storeEvents(events);
  return new Response(null, { status: 204 });
}

The events arrive as JSON, so createdAt is a string. Answer with a 2xx status only once they are stored: any other answer counts as failed and is logged on the sending side (there are no retries).

Transform. transform converts each event for one destination (ECS, OpenTelemetry, a flat row...), or returns null to skip it there. beforeLog stays the step before storage, for every destination. Annotate send's batch with what transform returns:

auth.ts
auditLog({
  destinations: [
    {
      name: "flat",
      transform: (event) =>
        event.status === "failure" ? { at: event.createdAt, type: event.type } : null,
      send: async (batch: { at: Date; type: string }[]) => {
        await saveFailures(batch);
      },
    },
  ],
});

Batching. By default every event is sent on its own, at once. With batch: { size, wait }, events wait in memory until size of them are together (at most 1,000), or the first has waited wait milliseconds (default 1000, at most 60,000).

Delivery is best effort. Sending runs in the background and never slows down or fails the request. A failing, throwing, or slow send (aborted after timeout, default 10 seconds, through the signal it gets) is logged with the destination's name and not retried; other destinations are not affected. Events waiting in a batch are lost if the process stops. So:

  • On serverless platforms, configure better-auth's advanced.backgroundTasks (e.g. waitUntil): the request that starts a batch then keeps the function alive until the batch is sent.
  • Before a long-running server stops, call the server-only flushAuditDestinations, which sends what is waiting and waits for running sends:
server.ts
process.on("SIGTERM", async () => {
  await auth.api.flushAuditDestinations();
  process.exit(0);
});

If every event must arrive, keep the database storage as the record and let the destination catch up from it.

onEvent is still there: it is called with every stored event and awaited before the request goes on (errors are logged). Prefer destinations for forwarding.

Storage

Events go to the auditEvent table by default. To keep them elsewhere, pass an object with write, read, and deleteOlderThan; the table is then not created. Only write is required, for a log service that can't be queried: without read, listEvents answers READ_NOT_SUPPORTED; without deleteOlderThan, retention is refused at startup and deleteExpiredAuditEvents answers DELETE_NOT_SUPPORTED. To keep the events in your database and send them elsewhere, use destinations instead.

memoryStorage() keeps events in memory, for tests:

auth.test.ts
import { auditLog, memoryStorage } from "@checodo/better-auth-audit-log";
import { betterAuth } from "better-auth";
import { expect } from "vitest";

const storage = memoryStorage();
const auth = betterAuth({ plugins: [auditLog({ storage })] });
// ...
expect(storage.events.map((event) => event.type)).toContain("sign-in");

Retention

Events are kept forever by default

Without retention, every IP address, user agent, and failed sign-in identifier stays in the log indefinitely. Data protection laws such as the GDPR expect personal data to be kept only as long as needed, so set a retention period that fits your purpose (90 days to a year is common for security logs), and say so in your privacy policy.

Events are kept forever unless you set retention. With retention: { days: 90 }, events older than 90 days are deleted in the background, at most once an hour (sweepInterval, in seconds), started by a recorded event. On serverless platforms, configure better-auth's advanced.backgroundTasks so the sweep can finish, or delete from a cron job with the server-only deleteExpiredAuditEvents:

cron.ts
const { deleted } = await auth.api.deleteExpiredAuditEvents({
  body: { days: 90 }, // optional with `retention`
});

Hash chain

Anyone who can write to your database can change or delete audit events without a trace. With hashChain: true, every event gets a link in the auditChain table: a sequence number and an HMAC-SHA256 hash over the event and the previous link's hash. Changing or deleting an event, or a link, breaks the chain from there on, and verifyAuditChain shows where:

auth.ts
auditLog({
  hashChain: true, // keyed with better-auth's secret
  // or a key of its own, kept out of the database (at least 32 characters):
  // hashChain: { secret: process.env.AUDIT_CHAIN_SECRET },
});
verify-audit-log.ts
const result = await auth.api.verifyAuditChain({});
// {
//   valid: false,
//   checked: 1832,                      // links checked
//   firstSequence: 1, lastSequence: 1832,
//   lastHash: "9f2c...",
//   problems: [{ sequence: 1204, eventId: "...", problem: "hash-mismatch" }],
//   unchainedEvents: 0,
//   nextSequence: null,                 // more to check? see below
// }
ProblemMeaning
hash-mismatchThe event (or its link) was changed after it was written
missing-eventThe event was deleted, its link wasn't
sequence-gapLinks before this one were deleted, usually with their events
broken-linkThe link doesn't continue the previous link's hash

unchainedEvents counts events stored since the first checked link that have no link: written into the table directly, or whose link failed (that error is logged).

On the server, verifyAuditChain reads every link unless you pass a limit, so run it from a scheduled job, not on requests. To check a long chain in parts, pass limit and continue with the result's nextSequence as afterSequence until it is null. Each part checks that it continues the link before it, and reports a sequence-gap if that link was deleted (unless no older link is left, as after retention); unchainedEvents is counted on the last part:

verify-audit-log.ts
let afterSequence: number | undefined;
do {
  const part = await auth.api.verifyAuditChain({ body: { afterSequence, limit: 5000 } });
  if (!part.valid) console.error("Audit chain problems", part.problems);
  afterSequence = part.nextSequence ?? undefined;
} while (afterSequence !== undefined);

Over HTTP, admins can run the same check with POST /audit-log/verify-chain (at most 10,000 links per request, rate limited), e.g. from an admin page. Without headers, auth.api.verifyAuditChain needs no session: it's your server code.

What it does and doesn't protect against:

  • The key matters. Hashes are keyed, so someone who can only write to the database can't recompute them for a changed event. Someone who also has the key can. A key of its own, stored apart from the database, keeps the two apart. Changing the key (or better-auth's secret, if you use it) makes every existing link fail verification.
  • The newest events. Deleting the newest events and their links leaves a shorter, valid chain, which verification can't tell apart from one that was never longer. Store lastHash and lastSequence somewhere else now and then (a log service, a ticket, an email) and compare them with a later verification.
  • The oldest events. Retention deletes the oldest events with their links; the chain then starts at firstSequence. Someone who deletes the oldest events by hand leaves the same picture, so verification alone can't tell it from retention. Compare firstSequence with what your retention period should have left.
  • Order. Concurrent writers, even on several servers, get one sequence number each through a unique index: the chain can't fork. Writing an event takes a few more queries.
  • Very heavy write load. A writer that loses the race for a sequence number tries again, up to 20 times. Under very heavy concurrent writing it can run out of tries: the event is still stored, the error is logged, and verification reports it in unchainedEvents (so valid is false), not as tampering.
  • Events before the chain. Events stored before you turned it on have no links and aren't checked.

It needs the default database storage; with custom storage, the plugin refuses to start. Destinations get the events, not the chain.

Export

Admins can export events as NDJSON (one JSON event per line, the default) or CSV, for an auditor, a spreadsheet, or another system. It takes the same filters as listEvents, returns events newest first, and is rate limited:

export-audit-log.ts
const response = await auth.api.exportAuditEvents({
  query: { format: "csv", from: new Date("2026-01-01"), limit: 10_000 },
});
const csv = await response.text();
const next = response.headers.get("x-next-cursor"); // more events? see below

Each request returns up to limit events (default 1,000, at most 10,000). When there are more, the x-next-cursor response header holds a cursor: pass it as cursor, with the same filters, for the next page. Events recorded while you export are newer than the export, so they never shift a page. CSV has a header row on the first page only, metadata as a JSON string, and a ' before cells that a spreadsheet would run as a formula (starting with =, +, -, @).

Over HTTP, GET /audit-log/export is for admins, and the response is a file download (audit-events.ndjson or audit-events.csv):

admin-page.ts
window.location.href = "/api/auth/audit-log/export?format=csv";

Without headers, auth.api.exportAuditEvents needs no session: it's your server code, e.g. a job that copies events to cold storage. It needs a storage with read (READ_NOT_SUPPORTED otherwise). Users can still list their own events with listEvents.

Running on several servers

The log itself lives in the database, so any number of servers can write to it and read from it. A few things are kept in each server process:

  • Sign-up or linked account. To record the first account of a new user as part of the sign-up rather than as account-linked, the plugin remembers new users for 10 seconds. The user and their first account are created in the same request, so this works on any number of servers.
  • Retention sweeps. Every process sweeps at most once per sweepInterval, so with several processes the database sees a few more (harmless) deletes. To sweep exactly once, leave retention unset and call deleteExpiredAuditEvents from one cron job.
  • Order within a millisecond. Each process makes sure its own events get increasing timestamps, so a sign-up lists before its sign-in. Events from different servers in the same millisecond can list in either order.
  • memoryStorage() keeps events per process. It is for tests.
  • Destination batches are kept per process, so each process sends its own batches.

When things fail

The audit log never breaks authentication: if storing an event fails, or onEvent or a destination throws, the error is logged and the request goes on. If beforeLog throws, the event is dropped and the error logged, so a broken pseudonymization never stores raw data. With better-auth's advanced.backgroundTasks, events are stored in the background, so they don't slow down responses.

Admins

Users with one of adminRoles (the role field of better-auth's admin plugin) or listed in adminUserIds can list every user's events, and filter by userId and actorUserId. Other users get a 403 for those filters; requests without a session get a 401.

const { data } = await authClient.auditLog.listEvents({
  query: { actorUserId: "admin-user-id", type: "admin.ban-user" },
});
EndpointClientServer
GET /audit-log/list-eventsauthClient.auditLog.listEventsauth.api.listAuditEvents
GET /audit-log/exportauthClient.auditLog.exportauth.api.exportAuditEvents
POST /audit-log/verify-chainauthClient.auditLog.verifyChainauth.api.verifyAuditChain
(server only)-auth.api.recordAuditEvent
(server only)-auth.api.deleteExpiredAuditEvents
(server only)-auth.api.flushAuditDestinations

Export and verification are for admins only over HTTP (403 for other users, 401 without a session), and rate limited to 10 requests a minute; change that with better-auth's rateLimit.customRules.

Schema

Table: auditEvent

Prop

Type

Table: auditChain, only with hashChain

Prop

Type

To rename the tables or their columns, use the schema option:

auth.ts
auditLog({
  schema: { auditEvent: { modelName: "audit_events", fields: { createdAt: "created_at" } } },
});

Error codes

Exported as AUDIT_LOG_ERROR_CODES from both entry points, to compare with error.code:

CodeStatusWhen
YOU_ARE_NOT_ALLOWED_TO_LIST_OTHER_USERS_EVENTS403listEvents with another userId, or actorUserId, for users who aren't admins
METADATA_TOO_LARGE400recordAuditEvent with more than 4,000 characters of JSON
RETENTION_NOT_CONFIGURED400deleteExpiredAuditEvents without days or retention
HASH_CHAIN_NOT_ENABLED400verifyAuditChain without the hashChain option
READ_NOT_SUPPORTED501listEvents or export with a custom storage that has no read
YOU_ARE_NOT_ALLOWED_TO_EXPORT_EVENTS403export for users who aren't admins
YOU_ARE_NOT_ALLOWED_TO_VERIFY_THE_CHAIN403verify-chain for users who aren't admins
INVALID_CURSOR400export with a cursor that isn't from x-next-cursor
DELETE_NOT_SUPPORTED501deleteExpiredAuditEvents with a custom storage that has no deleteOlderThan

Options

Prop

Type

Each entry of destinations:

Prop

Type

httpDestination takes name (default "http"), events, transform, batch, and timeout like above, plus:

Prop

Type

consoleDestination takes name (default "console"), events, transform, batch, and timeout.

On this page