Audit Logs

Source: This article refers to Audit Logs

In a Nutshell

Audit tables log changes in tables in company databases. For example, audit.Activity contains a new row for each change that has been done on each row in the activity table.

Audit tables can be queried using the Admin Query API.

Historical audit tables are available for the following DTOs:

In addition, audit logs for UDFs/Custom Objects can also be queried using the Query API.


Sample Queries

The following are examples of queries of audit logs that can be executed in the Admin Query API.

View Full Content of Given Table

The following query could be used to show the history of a DTO supported in audit logs (in this example: Activity):

SELECT aHistory from audit.Activity aHistory;

View Record with Most Changes

The following query you could view and sort records based on the number of changes in the audit log (in this example: Activity):

SELECT COUNT(aHistory.lastChanged), aHistory.code
FROM audit.Activity aHistory
GROUP BY aHistory.code
ORDER BY COUNT(aHistory.lastChanged) DESC LIMIT 1;

View History of Specific Record

The following query could be used to view the entire history of a specific record (in this example: Activity where aHistory code = '134' ):

SELECT aHistory.code, aHistory.checkedOut, aHistory.status, aHistory.executionStage, aHistory.lastChanged, aHistory.equipment, aHistory.lastChangedBy
FROM audit.Activity aHistory
WHERE aHistory.code = '134'
ORDER BY aHistory.lastChanged ASC;
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Article is closed for comments.