Skip to content

Features

Audit log

Requires a license with the audit feature. Streaming the log to an outside sink also needs audit-pro, which a license with audit does not include. See pricing.

The audit log records the actions admins and the instance take: who acted, what they changed, when, and from which address. You can search it, export it as JSON or CSV, send an export to an S3 bucket, and decide how long entries are kept.

  • Nothing in the API edits an entry, except a privacy erasure, which anonymizes the subject's personal data in their entries. Entries leave the log only through a super admin prune, a retention policy or the deletion of their tenant.
  • Each entry carries a sequence and a chain_hash, a keyed hash of the entry and the hash stored on the entry before it.
  • A tenant admin sees only their own tenant, with IP addresses and user agents masked. A super admin sees full values and every tenant.
  • A super admin's work on a tenant other than their own, such as creating, cloning, restoring, moving or deleting it, is filed under no tenant. Only a super admin who is not scoped to a tenant sees those entries.
  • Actions are named by area and verb, such as mfa.admin.reset or ai.settings.update. Resource types are plain names, such as user.

A prune, a retention pass and a tenant delete each leave a signed seal for every entry they remove, and an erasure seals each entry it anonymizes. The chain stays verifiable through all four, and a super admin checks it with GET /api/admin/audit-log/verify.

Open Insight > Audit log. The Entries tab lists the log, newest first, with the time, action, resource, user and address of each entry. Type an action, resource type or user id in the search box, or pick an action under All actions and a From and To date, then choose Search. A super admin also sees Prune.

Export JSON, and Export all for a super admin, sit beside Prune. Each downloads the log as JSON, under the filter in force.

The Entries tab of the audit log listing recent actions, newest first, each with its time, action, resource and the user who acted.

The Retention and holds tab lists the retention Policies and the Legal holds. New policy and New hold add one, the release button on a hold removes it, and Enforce now runs enforcement at once. The Streaming tab holds audit log streaming.

The Retention and holds tab with a policy that keeps every event on user for six months and archives it to default, and a legal hold named Case 2026-114 that protects entries on user.

Checking the chain, rehashing it, sending an export to S3 and the compliance export of a hold are done with the API. LyEve Console has no control for them on this release.

  1. Install a license that includes audit. See licensing and tiers.
  2. Set LYEVE_AUDIT_HMAC_KEY to 64 hex characters. Generate one with openssl rand -hex 32. A production instance refuses to start without it. Outside production, a missing key logs a warning and the chain is not protected by a secret.

Keep LYEVE_AUDIT_HMAC_KEY stable. Changing it breaks the chain for entries written before the change, until a rehash given the old key re-signs it. Without the license, the routes are not served and answer 404.

This needs a license with audit. Sign in as an admin. The steps read the schema.create entry that creating the post type in the quickstart wrote.

Read the newest entries:

Console v0.28.0

Open Insight > Audit log. The Entries tab shows the newest entry on top, with its time, action, resource, user and address. The count of entries is under the title.

Engine API v0.62.0

You need a token in TOKEN. The quickstart shows how to get one.

Shell
curl "http://localhost:3001/api/admin/audit-log?limit=1" \
-H "Authorization: Bearer $TOKEN"
JSON
{
"data": [
{
"id": "ae2e0796-abb9-4fe9-a5c7-4d60e0f7966e",
"sequence": 1,
"tenant_id": "default",
"user_id": "caeb8ec2-5c16-4d9d-96dd-a5b1b19f8fd8",
"action": "schema.create",
"resource_type": "schema",
"resource_id": "post",
"ip": "172.31.184.5:38982",
"user_agent": "curl/8.18.0",
"created_at": "2026-10-23T16:53:34.819104Z",
"chain_hash": "8fabd4295ac7fadc4520f577fbbb0731f6da13f69c3e24a9bcd0777807ac10ee"
}
],
"total": 1,
"limit": 1,
"offset": 0
}

total holds the number of entries.

Narrow it to actions on content types:

Console v0.28.0

Type schema in the search box and choose Search. The list shows the schema.create entry with schema/post as its resource. To narrow by one action instead, pick it under All actions and choose Search.

Engine API v0.62.0

Shell
curl "http://localhost:3001/api/admin/audit-log?resource_type=schema&limit=10" \
-H "Authorization: Bearer $TOKEN"

The answer holds the schema.create entry with "resource_id": "post".

Download the newest rows as CSV, two at most. The console exports JSON only, so this step is an API call. If you work in the console, sign in over the API to get a token, as Turn on drafts and publishing shows, and keep it in TOKEN:

Shell
curl -X POST http://localhost:3001/api/admin/audit-log/export \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"format": "csv", "limit": 2}'
id,user_id,action,resource_type,resource_id,ip,user_agent,ts
ae2e0796-abb9-4fe9-a5c7-4d60e0f7966e,caeb8ec2-5c16-4d9d-96dd-a5b1b19f8fd8,schema.create,schema,post,***.***.***.5:38982,curl/8.18.0,2026-10-23T16:53:34.819104Z

On an install where creating post is the only entry so far, as here, the file holds that one row. The address is masked in the export.

List the retention policies. A new install has none:

Console v0.28.0

Open the Retention and holds tab. Policies reads No retention policies yet and Legal holds reads No legal holds yet.

Engine API v0.62.0

Shell
curl http://localhost:3001/api/admin/retention-policies \
-H "Authorization: Bearer $TOKEN"
JSON
{ "data": [], "limit": 50, "offset": 0, "total_count": 0 }

GET /api/admin/audit-log needs an admin. An admin token can call it when it holds the audit:read grant.

ParameterMeaningDefault
actorUser id of the actor.all
actionExact action name.all
resource_typeExact resource type.all
resource_idExact resource id.all
fromRFC 3339, inclusive.none
toRFC 3339, exclusive. Must be after from.none
tenant_idOne tenant. Super admin only, ignored for anyone else.your tenant, or every tenant for a super admin
limitPage size, at most 500.50
offsetRows to skip.0

The list writes out pending entries before it reads, so an action you just took is in the result. If some were still queued, the answer carries "pending_writes": true and total is short.

RequestWho
POST /api/admin/audit-log/exportAn admin. Exports their own tenant.
POST /api/admin/audit-log/export-allA super admin. Exports every tenant.

Both take the same body. Every field is optional except format.

FieldMeaningDefault
formatjson or csv. CSV has a header row.
fromRFC 3339, inclusive.none
toRFC 3339, exclusive. Cannot be before from.none
action, resource_typeExact filters.all
limitRows. 0 means the default. Values above 1,000,000 are capped.100000
s3{"bucket", "key", "region"}. Uploads the export instead of returning it.none

IP addresses are masked in both exports, and user agents are cut to the browser or client name and version. A compliance export of a legal hold (below) keeps full values.

A download starts streaming before every row is read. If a row fails midway, the file ends early and the status is still 200. Compare the row count with what you expect.

Add "s3": {"bucket": "my-audit", "region": "us-east-1"} to the body. The answer is:

JSON
{ "rows_written": 5210, "object_key": "audit-exports/acme/2026/10/01/audit-export.csv", "bucket": "my-audit", "elapsed": "1.84s" }
  • Objects are encrypted at rest with S3 server-side encryption (AES256).
  • On the tenant export the object key is always under audit-exports/<tenant>/<YYYY/MM/DD>/, and a key you send is ignored. On export-all the key you send is used. It is required and cannot contain ... The format extension is added when the key lacks it.
  • Credentials come from the standard AWS sources: environment variables, the shared config file, or the instance role. region in the request wins over AWS_REGION.

A prune deletes entries older than a cutoff in the caller's tenant. It needs a super admin.

Console v0.28.0

On Insight > Audit log, choose Prune. Pick a date under Delete entries older than and choose Delete. Pruned entries cannot be recovered or exported afterwards.

Engine API v0.62.0

Shell
curl -X POST http://localhost:3001/api/admin/audit-log/prune \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"older_than": "2025-01-01T00:00:00Z"}'
JSON
{ "deleted": 3812 }

A cutoff later than now answers 400.

A prune skips every entry a legal hold covers. Each prune records itself as an audit.prune entry with the cutoff, the count and the first and last sequence it removed.

GET /api/admin/audit-log/verify walks the whole chain, every tenant's entries and the seals left by deletions and erasures. It needs a super admin.

Shell
curl http://localhost:3001/api/admin/audit-log/verify \
-H "Authorization: Bearer $TOKEN"
JSON
{ "valid": true, "entries": 3812, "sealed": 140, "broken": 0, "broken_sequences": [] }

entries counts the entries read and sealed the positions that verified through a seal. A broken chain still answers 200, with valid false, broken holding the number of broken positions and broken_sequences the first 100 of them. A changed entry breaks every position after it up to the next seal, so the first broken sequence is where to look.

On an install that pruned, enforced retention, erased a subject or deleted a user before 0.55.0, verify reports those positions as broken. POST /api/admin/audit-log/rehash accepts every entry as it stands and re-signs the seals that still verify. A seal that does not verify stays broken and is listed in left_broken. After you change LYEVE_AUDIT_HMAC_KEY, send the old key so the seals signed under it are re-signed under the new one:

Shell
curl -X POST http://localhost:3001/api/admin/audit-log/rehash \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"previous_key": "<the old 64 hex character key>"}'

The key serves that one request and is never stored, logged or returned. A rehash records itself as audit.chain.rehash, naming the positions that were broken before it ran. A body over 1 KiB answers 413.

A retention policy says how many days entries of an action and resource type are kept, and whether they are archived to your storage backend before they are deleted. A legal hold keeps matching entries past their retention window until the hold is removed.

A license with audit includes these routes. If the license lapses while the instance runs, they answer 402 and nothing is enforced. A license change applies without a restart. A privacy erasure of a subject that an active hold names in filter_resource_id or filter_actor erases nothing and reports the hold instead, whatever the license says. A hold set in any tenant counts.

Enforcement runs once at start and then every 24 hours. Set RETENTION_ENFORCE_INTERVAL to a duration such as 6h to change that.

Create a policy that keeps user entries for 180 days and archives them first. A super admin creates policies and holds:

Console v0.28.0

  1. On Insight > Audit log, open Retention and holds and choose New policy.
  2. Leave Event type empty, enter user in Resource type and 180 in Keep for, in days.
  3. Leave Archive before deleting on, which the form turns on for you. Enter default in Archive to and audit-archive/ in Path prefix.
  4. Choose Create. The page says Policy created, and the policy reads Every event on user, kept for 6 months, then Archived to default.

Engine API v0.62.0

Shell
curl -X POST http://localhost:3001/api/admin/retention-policies \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"event_type": "", "resource_type": "user", "retention_days": 180, "archival_enabled": true, "archival_path_prefix": "audit-archive/"}'

The answer is 201 with the policy, and archival_storage is default.

event_type is the action. An empty event_type or resource_type matches everything. retention_days defaults to 365 when you leave it out. An explicit 0 deletes matching entries on the next run.

Each archive is a CSV object under <archival_path_prefix>/<event_type>/<time>/policy-<id>-<run id>.csv, where <time> reads like 20261020-030000 in UTC. The run id keeps two runs in the same second from writing one object.

Create a hold:

Console v0.28.0

On Retention and holds, choose New hold. Enter Case 2026-114 in Name and user in Resource type, then choose Create. The form also filters on Action, Resource id and Tenant. A date range or an actor is set with the API.

Engine API v0.62.0

Shell
curl -X POST http://localhost:3001/api/admin/legal-holds \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "Case 2026-114", "filter_resource_type": "user", "filter_from": "2026-01-01T00:00:00Z"}'

Holds filter on filter_action, filter_resource_type, filter_resource_id, filter_actor, filter_from, filter_to and filter_tenant_id. name is required. A removed hold keeps protecting its entries for 30 days. A filter_resource_id that is a UUID is stored in lower case and matches the id written in lower or upper case.

Run enforcement now:

Console v0.28.0

On Retention and holds, choose Enforce now. The dialog asks Enforce retention now? and warns that it is not a dry run. Choose Delete them. The page reports how many policies ran and how many entries were deleted.

Engine API v0.62.0

Shell
curl -X POST http://localhost:3001/api/admin/retention/enforce \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{}'

Send {"cleanup_only": true} to delete without archiving. The answer lists each policy with entries_archived, entries_deleted and elapsed.

Export what a hold preserves. Only the API does this on this release, with a super admin token in TOKEN. A hold made in the console works the same way.

  1. List the holds and copy the hold's id into HOLD_ID:

    Shell
    HOLD_ID=$(curl -s http://localhost:3001/api/admin/legal-holds \
    -H "Authorization: Bearer $TOKEN" \
    | jq -r '.data[] | select(.name == "Case 2026-114") | .id')
  2. Export it:

    Shell
    curl -X POST http://localhost:3001/api/admin/retention/compliance-export \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d "{\"legal_hold_id\": \"$HOLD_ID\", \"format\": \"csv\"}" -o hold.csv

The answer is 200 with a CSV file of the entries the hold matches. A hold that matches no entry yet gives a file with the header line only.

Retention and hold routes
MethodPathWhoPurpose
GET/api/admin/retention-policiesAdminList policies.
POST/api/admin/retention-policiesSuper adminCreate a policy.
PUT/api/admin/retention-policies/{id}Super adminUpdate a policy.
DELETE/api/admin/retention-policies/{id}Super adminDelete a policy.
GET/api/admin/legal-holdsAdminList holds.
POST/api/admin/legal-holdsSuper adminCreate a hold.
DELETE/api/admin/legal-holds/{id}Super adminRemove a hold.
POST/api/admin/retention/enforceSuper adminRun enforcement now.
POST/api/admin/retention/compliance-exportSuper adminExport what a hold preserves.

With audit-pro on the same license as audit, a tenant streams each new entry to Splunk, Datadog or an HTTPS endpoint of its own, in order and about 10 to 30 seconds after it is written. Streams already set up keep shipping after audit-pro lapses. See Audit log streaming.

With flow-pro, flows can use two audit nodes:

  • audit.record writes one entry to the tenant's log. The actor is the flow unless you give a user id. A test run writes nothing.
  • audit.query reads a page of the tenant's log, newest first, with the same filters as GET /api/admin/audit-log and the same masking.
VariableWhat it doesDefault
LYEVE_AUDIT_HMAC_KEYKey for the hash chain, exactly 64 hex characters.Required in production
RETENTION_ENFORCE_INTERVALHow often retention policies are enforced.24h

If you set LYEVE_PLUGINS to choose which features start, include audit in it.

MethodPathWhoPurpose
GET/api/admin/audit-logAdminSearch the log.
POST/api/admin/audit-log/exportAdminExport your tenant.
POST/api/admin/audit-log/export-allSuper adminExport every tenant.
POST/api/admin/audit-log/pruneSuper adminDelete entries before a cutoff.
GET/api/admin/audit-log/verifySuper adminCheck the hash chain.
POST/api/admin/audit-log/rehashSuper adminRe-sign the chain after a deliberate reset.
StatusMessageCause
400invalid filter parametersA list parameter is malformed, or to is not after from.
400format must be 'json' or 'csv'Export or compliance export with another format.
400'to' must be after 'from'Export range is reversed.
400limit must be >= 0Export with a negative limit.
400older_than must be RFC 3339 (e.g. 2024-01-01T00:00:00Z)Prune cutoff is not a timestamp.
400older_than must not be later than nowPrune cutoff is in the future.
400previous_key must be 64 hexadecimal charactersRehash with a malformed old key.
400name is requiredLegal hold without a name.
400legal_hold_id is requiredCompliance export without a hold.
402payment_requiredThe license lapsed while the instance ran.
403tenant context required for exportTenant export from a token with no tenant.
403insufficient permissionsA tenant admin called a super admin route, such as prune or export-all.
422s3 bucket is not a valid bucket nameThe bucket name breaks S3 naming rules.
503failed to load audit log, s3: upload failedThe database or S3 did not answer. Retry.
  • Logs: what the instance logged while serving requests.
  • Admin tokens: an audit:read token for a script or a SIEM.
  • Analytics: daily active users, counted from this log.
  • Secure your instance: the hardening steps, including the audit key.