For Developers

Audit Events

Audit Logs are currently in beta and therefore subject to change.

These methods authenticate with your application secret. edlink.meta uses the client_secret from the SDK constructor. You can also pass an application token set to edlink.use.

Create Event

audit_events.create(event);
audit_events.create(events);

Record one Event, or a batch of 1–100. If any Event in a batch fails validation, none are recorded.

Arguments

ParameterTypeDescription
eventEvent | Event[]A single event or array of events to be recorded in the audit logs.

Event Fields

FieldRequiredDescription
actorYesThe entity that performed the action.
actionYesYour name for the action, such as user.login.success.
targetsYesThe entities the action affected.
scopeYesYour identifier for this group of Events, up to 128 bytes.
dataNoPayload for a normal Event. Do not send this with after.
beforeNoState before an update. Send with after instead of data.
afterNoState after an update. Do not send this with data.
severityNodebug, low, medium, high, or emergency. Defaults to debug. The SDK exports these values as AuditEventSeverity.
created_dateNoA Date or an ISO-8601 string. Must be within the last 30 days, and not more than 24 hours in the future. If omitted, Edlink uses the time it received the request.

Schema warnings are logged when log_level is debug, which is the default. A strict Schema mismatch throws.

Example Usage

const result = await edlink.meta.audit_events.create({
    action: 'user.login.success',
    severity: 'medium',
    actor: {
        type: 'person',
        identifiers: [{ value: 'user_0001', issuer: 'acme' }]
    },
    targets: [{ type: 'person', identifiers: [{ value: 'user_0001', issuer: 'acme', name: 'Ada Lovelace' }] }],
    scope: 'acme-tenant-7f3a',
    data: {
        login_method: 'password'
    }
});

console.log(result.id);

Fetch Event

audit_events.fetch(event_id);

Retrieve a recorded Event by the id returned from create.

A newly recorded Event can take a few seconds before it is available to fetch.

If the Event was recorded with data, the payload comes back as data. If it was recorded with before and after, those fields come back instead.

Arguments

ParameterTypeDescription
event_idstringThe UUID of the Event.

Example Usage

const event = await edlink.meta.audit_events.fetch(result.id);
console.log(event.action);