Audit Log Details

Detailed activity record

Back
Audit Information
Model
<%= auditLog.model %>
Action
<% let badgeClass = 'badge-soft-primary'; if (auditLog.action.includes('CREATE')) badgeClass = 'bg-soft-success'; else if (auditLog.action.includes('UPDATE')) badgeClass = 'bg-soft-warning'; else if (auditLog.action.includes('DELETE')) badgeClass = 'bg-soft-danger'; %> <%= auditLog.action %>
Document ID
<%= auditLog.documentId %>
Date & Time
<%= new Date(auditLog.createdAt).toLocaleDateString('en-GB') %> <%= new Date(auditLog.createdAt).toLocaleTimeString() %>
Performed By
<% if (auditLog.performedBy) { %>
<%= auditLog.performedBy.username %>
<%= auditLog.performedBy.email %>
<% } else { %> System <% } %>
IP Address
<%= auditLog.ipAddress %>
<% if (auditLog.userAgent) { %>
User Agent
<%= auditLog.userAgent %>
<% } %>
<% if (auditLog.changes && auditLog.changes.length > 0) { %>
Field Changes
<%= auditLog.changes.length %> field<%= auditLog.changes.length > 1 ? 's' : '' %>
<% if (user && (user.role === 'admin' || user.role === 'superadmin')) { %>
<% auditLog.changes.forEach(change => { %> <% }); %>
Field Before After
<%= change.field %>
<% if (change.before === null || change.before === undefined) { %> null <% } else if (typeof change.before === 'object') { %>
<%= JSON.stringify(change.before, null, 2) %>
<% } else { %> <%= change.before %> <% } %>
<% if (change.after === null || change.after === undefined) { %> null <% } else if (typeof change.after === 'object') { %>
<%= JSON.stringify(change.after, null, 2) %>
<% } else { %> <%= change.after %> <% } %>
<% } else { %>
Detailed field values are restricted to administrators.
<% auditLog.changes.forEach(change => { %>
<%= change.field %> Modified
<% }); %>
<% } %>
<% } %>
Summary
<%= auditLog.changes ? auditLog.changes.length : 0 %>
Fields Changed
<%= new Date(auditLog.createdAt).toLocaleDateString('en-GB') === new Date().toLocaleDateString('en-GB') ? 'Today' : 'Past' %>
Timing