Skip to main content

aegis.getAuditLog()

Returns all AuditEvent objects recorded in the current session.

In the preview SDK, events are stored in-memory. In the full SDK, events are shipped to the Auditail API and queryable via the dashboard.


Signature​

aegis.getAuditLog(): AuditEvent[]

AuditEvent Schema​

interface AuditEvent {
auditId: string;
agentId: string;
userId?: string;
action: string;
payload: Record<string, unknown>;
approved: boolean;
reason?: string;
matchedRule?: string;
tags?: Record<string, string>;
timestamp: string; // ISO 8601 UTC
environment: string;
sdkVersion: string;
}

Example​

const log = aegis.getAuditLog();

// All blocked events
const blocked = log.filter(e => !e.approved);

// Events by agent
const billingBotEvents = log.filter(e => e.agentId === 'billing-bot-01');

// Print a summary
log.forEach(e => {
const status = e.approved ? '✅' : '🚫';
console.log(`${status} [${e.action}] agent=${e.agentId} id=${e.auditId}`);
});