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
| Parameter | Type | Description |
|---|---|---|
event | Event | Event[] | A single event or array of events to be recorded in the audit logs. |
Event Fields
| Field | Required | Description |
|---|---|---|
actor | Yes | The entity that performed the action. |
action | Yes | Your name for the action, such as user.login.success. |
targets | Yes | The entities the action affected. |
scope | Yes | Your identifier for this group of Events, up to 128 bytes. |
data | No | Payload for a normal Event. Do not send this with after. |
before | No | State before an update. Send with after instead of data. |
after | No | State after an update. Do not send this with data. |
severity | No | debug, low, medium, high, or emergency. Defaults to debug. The SDK exports these values as AuditEventSeverity. |
created_date | No | A 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. |
The Event Model
API Reference
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
| Parameter | Type | Description |
|---|---|---|
event_id | string | The UUID of the Event. |
Example Usage
const event = await edlink.meta.audit_events.fetch(result.id);
console.log(event.action);
