Audit trail

The Platform keeps an audit trail of changes and other events. Plugins can write custom entries to the audit trail.

function O.audit.query()

Constructs a new object implementing the AuditEntryQuery interface.

This object may be used to filter, sort and return audit trail events. Note that this will only find audit entries that have labels which permit the current user to read them.

function O.audit.write(dictionary)

Writes an entry to the audit trail. The dictionary passed to the function specifies the entry, using the keys described below.

Returns an AuditEntry representing the entry written.


Given a store object, storeObject, this example code writes a custom entry to the audit trail.

        auditEntryType: "example:important_activity",
        ref: storeObject.ref,
        data: {
            "person": "Joe"

Audit entry specification

The dictionary passed to O.audit.write() only needs to specify the following keys. All the other information found in the AuditEntry interface is filled in automatically.

key auditEntryType

Required. A String specifying the kind of audit entry, in the form organisation:type, where organisation is your organisation’s allocated prefix.

key ref

(Optional) A Ref of a store object, if this entry refers to a store object. Omit entirely to create a general entry.

key data

(Optional) A JSON compatible data structure giving any additional information needed about the entry.