Skip to content

Audit Who Did What

ConfigHub records each write to an entity as an AuditEvent: who made it, on whose behalf, under what grant, to which entity, from where, and when. Writes that are refused are recorded too, and so are logins, the writes ConfigHub makes itself for someone, such as a Trigger's or a resolve's, and the commands an operator runs on the server. Audit events are never changed or deleted through the API. They play the part of the Kubernetes audit log or a cloud provider's activity log, for ConfigHub's own entities.

Audit events complement the history ConfigHub keeps of configuration. A Unit's Revisions record each change to its configuration with a description and a diff, and blame says which change set each value. An audit event of a Unit's change names the Revision that holds it rather than repeating the diff. For everything else, such as a Trigger's update, a permission change or a delete, the audit event holds the entity's fields before and after the action, as Before and After.

This page goes through the questions audit events answer. The AuditEvent page describes every field, Action and Origin.

Who can see what

The admin and manager roles see every audit event of the Organization. Anyone else sees the events of their own actions, and the events about entities they can view, such as the changes to the Units of a Space they can read. Events of logins and credentials are seen only by the User they are about and by the admin and manager roles, and the source address and User-Agent of someone else's request are shown only to those roles. So the same command can list more events for an admin than for you; an event you cannot see is reported as not found.

Listing and following events

cub audit list lists events. --since and --until take RFC 3339 times and select a time range, and --where filters them as for any other list:

cub audit list --since 2026-11-01T00:00:00Z --until 2026-12-01T00:00:00Z
cub audit list --where "Outcome = 'Denied'" --since 2026-11-01T00:00:00Z

The table shows each event's ID, when it occurred, the Action, the type and slug of the entity, the Outcome and the User. cub audit get shows one event in full, by ID; -o yaml or -o json includes its Before and After:

cub audit get 61f26b06-3c34-4363-8b9d-7d0a7c2b5f1c -o yaml

cub audit tail prints events as they are recorded, until interrupted, and takes --where too:

cub audit tail --where "Outcome = 'Denied'"

cub audit explain describes each field, and cub audit explain --where lists the attributes --where can name: Action, Origin, Outcome, OccurredAt, UserID, OnBehalfOfUserID, Role, Grants, SubjectEntityType, SubjectEntityID, SpaceID, RequestID, AuditEventID and OrganizationID. Slugs are not among them: an entity is selected by its ID, since it may have been renamed or deleted since the event.

Finding who changed an entity

Look up the entity's ID, then list the events about it:

unitID="$(cub unit get --space payments-prod web -o jq='.Unit.UnitID')"
cub audit list --where "SubjectEntityID = '$unitID'" --since 2026-11-01T00:00:00Z

The USER column is who acted. When it is a bot, a service account or ConfigHub itself, cub audit get shows the person it acted for in OnBehalfOfUserID, and what made the change in Origin: API for a request, Trigger or Resolve for a change ConfigHub made to the Unit as it resolved it, and ChangeOrder for a stage the server advanced.

The same works for any entity, such as a Trigger, a Space or a Target, with its own get command and ID field.

Seeing what changed

What an event says changed depends on where the change is kept:

  • A Unit's configuration: the event's RevisionID names the Revision that holds it. Find the Revision's number and compare it with the one before it:

    cub revision list --space payments-prod web --where "RevisionID = '<revision-id>'"
    cub unit diff --space payments-prod web --from=<num-1> --to=<num>
    
  • An entity with a backing Unit, such as a Trigger or a Filter: RevisionID names a Revision of the backing Unit, which holds the entity's document before and after.

  • Everything else, such as a permission change or a Patch of a Unit's labels: ChangedFields names the fields, and Before and After hold their values. Read them with cub audit get <id> -o yaml.

Finding what was deleted

List the deletes, of one type of entity or in one Space:

cub audit list --where "Action = 'Delete' AND SubjectEntityType = 'Unit'" --since 2026-11-01T00:00:00Z
cub audit list --where "Action = 'Delete' AND SpaceID = '<space-id>'" --since 2026-11-01T00:00:00Z

The SLUG column has the entity's slug as it was. cub audit get <id> -o yaml shows its last state in Before. A deleted Unit's Revisions are deleted with it, so its event keeps its metadata in Before and its head Revision's number and hash, but not its configuration data. To be able to bring a Unit back, archive it instead of deleting it.

Investigating refused writes

A write that authorization refused has Outcome Denied, and one that was allowed but failed has Failed. Both keep the Action that was attempted, and Error has the message the caller was given:

cub audit list --where "Outcome = 'Denied'" --since 2026-11-01T00:00:00Z
cub audit list --where "Outcome = 'Denied' AND UserID = '<user-id>'" --since 2026-11-01T00:00:00Z

A refused credential is a Login, TokenExchange or RefreshToken event with Outcome Denied. Refused reads are not audit events; the server's request log has them.

Tracing what automation did

ConfigHub writes for people: a Trigger or a Link changes a Unit as it is resolved, a ChangeOrder advances to its next stage, a bot runs a command. Each of these events names the person in OnBehalfOfUserID, so selecting by it finds what was done for someone, and by Origin finds what one kind of automation did:

cub audit list --where "OnBehalfOfUserID = '<user-id>'" --since 2026-11-01T00:00:00Z
cub audit list --where "Origin = 'Trigger'" --since 2026-11-01T00:00:00Z

A Trigger's change to a Unit is recorded on the Unit, with the Revision it made. The Revision's Mutations name the Triggers that made each change, and blame shows them path by path.

Following one request

Every event a request recorded has its RequestID, so a bulk change of fifty Units is fifty events that share one. Select them together:

cub audit list --where "RequestID = '<request-id>'"

The same ID appears in the server's request log, which has the request itself.

Reviewing access

cub audit report answers the questions a review of access usually asks, over a time range. Each report is one or more filters over the audit events; the events they match are listed oldest first, with Users and Groups named where you can see them.

Report What it lists
AccessChanges Every permission change, member add and remove, role change, change to a Group's bots, change of a User's Groups at login, and credential create and delete
PrivilegedActions Everything done with the admin role, or by an operator on the server
UserActivity Every action by or on behalf of one User, given with --user
SpaceChanges Every action on one Space, given with --space, and the entities in it
Deletions Every delete, with the entity's final state in Before
Denied Every refused write, or with --user, those of one User
GrantUsage Every action a Group's grants allowed, given with --group
cub audit report AccessChanges --since 2026-10-01T00:00:00Z --until 2027-01-01T00:00:00Z
cub audit report UserActivity --user jane@example.com --since 2026-11-01T00:00:00Z --until 2026-12-01T00:00:00Z

A report covers only the events you can see, so a review of the whole Organization is run by someone with the admin or manager role.

-o csv writes a report as CSV, for a spreadsheet or an auditor. -o json and -o yaml show each event in full, such as the final state of a deleted entity in a Deletions report:

cub audit report AccessChanges --since 2026-10-01T00:00:00Z --until 2027-01-01T00:00:00Z -o csv > access-changes-q4.csv

Before removing someone from a Group

Each event records the grants that allowed it in Grants, including the Group a grant named. GrantUsage lists every action a Group's grants allowed, which shows what its members have been using it for, and what someone removed from it will no longer be able to do:

cub audit report GrantUsage --group platform-admins --since 2026-09-01T00:00:00Z --until 2026-12-01T00:00:00Z -o csv

Membership of people in Groups is managed in the identity provider, which keeps its own record of those changes. ConfigHub records the change of a User's Groups when it sees it, at the User's next login, in the Organization the User logged in to.

Sending audit events to another system

Audit events are kept for 400 days by default, and then removed a month at a time; see retention. To keep them longer, or to collect them in a SIEM, copy them out as they are recorded, in either of two ways:

  • Pull them from the API. A collector lists events in time order and keeps its own position, reading from the last OccurredAt it has. It needs a credential with the admin or manager role to read them all, such as a service account:

    cub audit list --since "$lastSeen" --order-by OccurredAt -o json
    

    An event becomes visible when its write commits, which can be a little after its OccurredAt, so read again over the last minute or so and drop the events already seen by AuditEventID, as cub audit tail does.

  • Collect them from the server's log (self-hosted). With CONFIGHUB_LOG_AUDIT_EVENTS=true, the server also writes each event to its log output once its write commits, as one JSON line with "msg":"audit event", so a log pipeline that already collects the server's logs collects these too. The events in the database are kept either way.