Audit logs
Record who did what with AUDIT() and $.audit(), audit actions after they succeed, and store the records where you need them.
AUDIT() writes who did what. It reads the user, IP address, user agent, URL and action from $:
NEWACTION({
id: 'Orders/remove',
params: '*id:UID',
action: function($) {
$.audit('Removed order {params.id} by {user.name}');
$.success();
}
});A record contains userid, createdby (the name, nick or alias of the user), sessionid, ip, ua, url, action, type, message, app and dtcreated. data contains the params, query, model and uploaded files (name, filename, size, width, height) as JSON, without the fields password, token, accesstoken, access_token and pin.
Each record is a line of JSON in /logs/audit.log (or /logs/<name>.log for AUDIT('name', $, ...)). Replace DEF.onAudit to store records elsewhere. An action with audit: true or with a Tangular template (audit: 'Removed {{ $.params.id }}') is audited into /logs/actions.log after it succeeds.