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
- TypeScript
- Python
aegis.getAuditLog(): AuditEvent[]
aegis.get_audit_log() -> list[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
- TypeScript
- Python
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}`);
});
log = aegis.get_audit_log()
blocked = [e for e in log if not e.approved]
for event in log:
status = "✅" if event.approved else "🚫"
print(f"{status} [{event.action}] agent={event.agent_id} id={event.audit_id}")