Configure a logger for auditsΒΆ
Premise
This tutorial illustrates the main steps to configure an event logger to perform audits for changes of attribute values of nodes of interest. Then records the occurrences of the AuditWriteUpdateEventType event generated inside the Model node.
The data collected on the event are the following:
Event source, i.e. the project node on which the events are listened to.
ID information of the user who generated the event.
Event date and time.
Change data of the attribute value (before/after the edit).
Download the example project from here
. In this example, in addition to the AttributeChangeLogger logger subject of the tutorial, there are several loggers that each record only one audit event. For an example of a logger that records several audit Types of Events, download the example project from here
.
Steps
Add an Event logger
In Project, right-click Loggers, then select New, then click Event logger: EventLogger1 appears in the example project renamed AttributeChangeLogger.
In the Database property, select the database in which to store the selected properties: a table for each event type is automatically created and configured in the database; and in each table, a column for each property to be stored.
Configure the event source and event type to listen to
Click next to Event configuration: the set of properties for the event configuration appears.
Next to Event source, click and select the project node of interest. In the example, the event source is the Model node.
Set the Subtree listen property to True: the logger also records the events of interest generated in the Model folder child nodes.
Next to EventType, click and select AuditWriteUpdateEventType.
Set Non-interactive sessions excluded to True.
In Project, double-click the Event logger object: the list of properties of the selected event type is displayed in the object editor.
Select the event properties of interest
Double-click the Event logger: the complete list of the event type AuditWriteUpdateEventType properties appears in the editor.
Select the following properties.
Properties
Description
SourceName
Node BrowseName
SourceNode
Node path
Time
Timestamp of the action performed by the user
ClientUserID
Session user ID
AttributeId
Name of edited attribute
NewValue
New attribute value
OldValue
Old attribute value
Click Apply to confirm the properties to record: the properties appear in Event fields to log. Columns corresponding to the selected properties are automatically created in the database.
Note
when a property to record is selected, a dynamic link with it is automatically set inside Event fields to log. The dynamic link points to an attribute automatically selected by Q Studio. If the attribute does not represent the data of interest, select a different attribute in the dynamic link window.
Configure a custom property for the event
Custom properties can be added in addition to the native properties of the event of interest.
The custom property ValueChange was added in the example project, i.e. a localizable string that displays the OldValue and NewValue values of the attribute that was changed.
To add a property to record, click next to Event fields to log: the new property appears, renamed ValueChange in the example project.
To use the OldValue and NewValue values in the property, an advanced dynamic link must be configured using a String formatter type converter. Refer to the example project for the configuration. For details on the converter, refer to String formatter.