Every operation changing the content is logged in an event log.

events and migrations

Events in event log are NOT transformed when you execute a migration.

Querying the event log

Anyone with history permission can query the event log. You can do it by sending GraphQL events query to /system/<project> endpoint.

Example: listing events

query {
    events {
        id
        # ...
    }
}

Event log: fields

There are 3 GraphQL types of events: UpdateEvent, CreateEvent and DeleteEvent with following fields available

fields availability

Fields oldValues, diffValues and newValues are available only for some event types. See notes in table below.

FieldGraphQL TypeDescription
idString!Unique identifier of the event
typeEventType!One of UPDATE, DELETE and CREATE
createdAtDateTime!When the event was created
appliedAtDateTime!When the event was applied (transaction was committed)
identityIdString!Identity ID of the user who performed the operation
identityDescriptionString!Description of the user who performed the operation
tableNameString!Name of the table affected by the event
primaryKey[String!]!Primary key of the row affected by the event (for entities it contains a single element with it's id, for ManyHasMany junction tables it contains IDs of both entities)
oldValuesJson!Old value of the row affected by the event (available only on UpdateEvent and DeleteEvent)
diffValuesJson!Diff between old and new values of the row affected by the event (available only on UpdateEvent)
newValuesJson!New value of the row affected by the event (available only on CreateEvent)

Event log: filtering, sorting and pagination

Using args (of type EventArgs) argument you can filter, sort and paginate the event log.

Here is structure of EventArgs type:

input EventsArgs {
  stage: String
  filter: EventsFilter
  order: EventsOrder
  offset: Int
  limit: Int
}
enum EventType {
  UPDATE
  DELETE
  CREATE
}
enum EventsOrder {
  CREATED_AT_ASC
  CREATED_AT_DESC
  APPLIED_AT_ASC
  APPLIED_AT_DESC
}

input EventsFilter {
  types: [EventType!]
  rows: [EventFilterRow!]
  tables: [String!]
  transactions: [String!]
  identities: [String!]
  createdAt: EventsFilterDate
  appliedAt: EventsFilterDate
}

input EventsFilterDate {
  from: DateTime
  to: DateTime
}

input EventFilterRow {
  tableName: String!
  primaryKey: [String!]!
}

Example: getting last 100 events creating an article

query {
  events(args: {
    filter: {
      types: [CREATE],
      tables: ["article"],
    },
    limit: 100,
    order: APPLIED_AT_DESC,
  }) {
    id
    identityId
    appliedAt
    ... on CreateEvent {
      newValues
    }
  }
}