Skip to main content

aegis.getAuditLog()

Returns all AuditEvent objects recorded in the current session.

This returns the events recorded by this process with no network call. Every event is also delivered to Auditail in the background; use the dashboard or the REST API to query the persistent, hash-chained log across processes and restarts.


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}`);
});