Auditing Object Events
Liferay 7.4 U72+/GA72+
You can use Liferay’s audit framework to track events for custom object definitions and their entries. To track entry events, you must enable entry history for the object definition. While enabled, you can view an entry’s history via the Audit application or REST APIs.
Using the Audit Application
Subscription
To access the Audit application, open the Global Menu () → Control Panel → click Audit.
Events appear in a table:
Column | Description |
---|---|
User ID | Acting user’s ID. |
User Name | Acting user’s name. |
Resource ID | Affected resource’s ID. |
Resource Name | Affected resource’s name, including its ID (e.g., ObjectDefinition#44168 ). |
Resource Action | Action performed (ADD , UPDATE , or DELETE ). |
Client IP | IP address responsible for the action. |
Create Date | When the event record was created. |
Click an event field to view a more complete record, including specific action details. You can search and filter results using keywords and other terms.
Object entry events use the ObjectDefinition#[ObjectID]
naming pattern.
Using REST APIs
You can use the nestedFields
parameter with the auditEvents
value to return an entry’s history in GET API calls (e.g., http://localhost:8080/o/c/tickets/?nestedFields=auditEvents
). See Using nestedFields to Audit Entry History for a basic tutorial.
Using REST APIs to view an entry’s history requires both the View
and Object Entry History
permissions for the entry. See Permissions Framework Integration for more information.
Enabling Entry History
By default, entry history is disabled for custom objects. For 7.4 U72+/GA72+, you can configure this setting at any time. In earlier versions, you can only configure this setting before publishing the object definition.
To enable entry history,
-
Open the Global Menu (), go to the Control Panel tab, and click Objects.
-
Begin editing the desired object definition.
-
In the Details tab, toggle Enable Entry History.
-
Click Save.
While enabled, Liferay keeps a history of entry events that you can view in the Audit application or via REST API calls.