Difference between revisions of "Audit Trail"

From InfiniteERP Wiki
Jump to: navigation, search
(Audit Inserts)
(Running the 'Update Audit Trail infrastructure process')
Line 56: Line 56:
 
== '''Running the 'Update Audit Trail infrastructure process'''' ==
 
== '''Running the 'Update Audit Trail infrastructure process'''' ==
  
 +
'''Note''':
 +
* From Openbravo PR18Q2 on the Update Audit Trail Infrastructure process will not be available, and the update of the audit trail instrastructure will require to stop Tomcat, rebuild Openbravo and start Tomcat again
 +
* Executing this process causes database to be locked, which might stop any other parallel process.
 +
Therefore, it is '''highly discouraged''' to run in while there is activity in the system. It should be executed while in non working hours, or with the system in maintenance by compiling the application from command line.
  
 +
The audit trail system uses a number of generated triggers (one per table to be audited) to collect the audit data for all changes.
  
 +
These triggers need to be regenerated once the following actions have been performed:
 +
* The Audit Trail feature has been enabled or disabled for a table
 +
* There has been any structural change to a table being audited (i.e. new columns, changed columns)
 +
 +
This process can be execute as described below:
 +
* Switch to System Administrator role
 +
* Go to Application Dictionary
 +
* Start the 'Update Audit trail infrastructure process'
 +
* After confirmation, the process starts and recreates all audit triggers (by removing and creating them again).
 +
* While this process is executed the background scheduler is suspended
 +
 +
'''NOTE''': This process is also automatically executed on each compilation if the audit trail feature has been enabled for any table.
 +
 +
[[File:AuditTrailUpdateAuditTrail.png]]
 +
 +
 +
== '''The Audit Trail Popup''' ==
 +
For the set of tables for which the audit trail feature has been enable a new button [[file:WIK button Audit.png]] is shown in the toolbar of the corresponding windows. It gives access to the Audit Trail Popup.
 +
 +
This popup allows examination of the history of the record which is currently shown in the window. It has two main view modes which allow to examine the following data:
 +
* 'Record history' of a single record
 +
* 'Deleted records' of a single tab
 +
 +
 +
== '''The 'Record History' view''' ==
 +
This view is displayed when the popup is opened from an existing record via the new toolbar button.
 +
 +
The top area always shows a reference to the entity (i.e. Sales Order) and the record "1000175 - 2016-04-03 00:00:00.0-0.00" for which the history is displayed.
 +
 +
Then a number of filters are available which allow some restriction on the changes displayed to ease the use for record with many modifications.
 +
 +
The grid in the lower area shows all changes done to this record while the audit trail feature was enabled. The changes are shown sorted from the most recent change back to earlier changes.
 +
 +
'''Note''':
 +
* Only fields which are visible in the corresponding tab are shown here
 +
 +
A row in this grid corresponds to a single changed field. For changes to an existing record the number of grid entries shown correspond to the number of fields changed. For new record creations or record deletion one row in the grid is shown per field of the inserted/deleted record.
 +
 +
[[File:Audittrail popup.png]]
 +
 +
Finally a link just on top of the grid allow switching to the 'Deleted Records' view. Following that link will show deleted records for the tab from which the Audit Trail popup was opened.
 +
 +
 +
== '''The 'Deleted Records' view''' ==
 +
 +
This view allow examination of records which have been deleted from a tab and are otherwise no longer accessible in the user interface.
 +
 +
The general layout of the view is similar to the record history view.
 +
 +
An info on the top shows a reference to the entity for which the deleted records are shown. Directly below a number of filters is available to restrict the records shown.
 +
 +
Then a grid displays all deleted records belonging to this tab/entity. Here one row shown corresponds to a single deleted record and the columns shown are the same as the ones shown in the normal grid view of the same tab.
  
  

Revision as of 16:25, 26 October 2018

Back button.png   Back to General Setup


Introduction

Audit Trail allows to monitor every data change done in any table or entity through the user interface.

Audit trail feature monitors data changes such as:

  • Insert
  • Update
  • Delete

Audit trail feature must be enabled by the "System Administrator Role" in the Application Dictionary as the first thing to do is to configure the table/s for which this feature is going to be enabled.

Once a change has been done in a table for which audit trail feature has been enabled, it is be possible to monitor that change through the user interface by using the action button "Audit Trail".

AuditTrail History.png


Audit Trail

Audit Trail view displays read-only infromation about all the recorded data changes done in the tables for which the audit trail feature has been enabled.

AuditTrail Window.png

Configuration

In order to track audit information the system administrator needs to perform two tasks:

  • Enable the audit trail for one or more tables in the system
  • Run the 'Update Audit Trail infrastructure' process

Note: From Openbravo PR18Q2 on the Update Audit Trail Infrastructure process will not be available, and the update of the audit trail instrastructure will require to stop Tomcat, rebuild Openbravo and start Tomcat again


In the following sections, a step-by-step guide with more detailed information is provided.

Enabling audit trail for a table

Enabling/disabling the audit trail feature for a table is done in the Table definition in the Application Dictionary.

  • Switch to the System Administrator role
  • Goto Application Dictionary -> Tables and Columns
  • Navigate to the table for which you want to enable the Audit Trail
  • Switch to Edit View
  • Mark the "Fully Audited" checkbox and save

Audit Inserts

When a table is flagged as Fully Audited, the user can decide if he wants to audit the insertions done in that table.

AuditInserts.png

If the Audit Inserts field is checked in a table, when a new row is inserted in that table several records will be inserted in the Audit Trail table, one for each column in the audited table. This records will contain the original value of the columns of the new row.

Usually it is not needed to store this information, because the original value of a column could be easily obtained by using the Old Value and New Value fields of the Audit Trial table that corresponds with that column. If the Audit Inserts field is left unchecked, only one row will be inserted in the Audit Trial table for each record inserted in the audited table. At least this one record needs to be inserted in the Audit Trial table to be able to store which process was used to create the record in the audited table.

Excluding columns

By default when a table is audited, modifications on any of its columns are audited. In some cases it makes sense not to audit changes for some of them. This can be configured by setting the Exclude Audit flag in Tables and Columns > Table > Column tab.

AuditTrailEnableAuditTrail.png

Running the 'Update Audit Trail infrastructure process'

Note:

  • From Openbravo PR18Q2 on the Update Audit Trail Infrastructure process will not be available, and the update of the audit trail instrastructure will require to stop Tomcat, rebuild Openbravo and start Tomcat again
  • Executing this process causes database to be locked, which might stop any other parallel process.

Therefore, it is highly discouraged to run in while there is activity in the system. It should be executed while in non working hours, or with the system in maintenance by compiling the application from command line.

The audit trail system uses a number of generated triggers (one per table to be audited) to collect the audit data for all changes.

These triggers need to be regenerated once the following actions have been performed:

  • The Audit Trail feature has been enabled or disabled for a table
  • There has been any structural change to a table being audited (i.e. new columns, changed columns)

This process can be execute as described below:

  • Switch to System Administrator role
  • Go to Application Dictionary
  • Start the 'Update Audit trail infrastructure process'
  • After confirmation, the process starts and recreates all audit triggers (by removing and creating them again).
  • While this process is executed the background scheduler is suspended

NOTE: This process is also automatically executed on each compilation if the audit trail feature has been enabled for any table.

AuditTrailUpdateAuditTrail.png


The Audit Trail Popup

For the set of tables for which the audit trail feature has been enable a new button WIK button Audit.png is shown in the toolbar of the corresponding windows. It gives access to the Audit Trail Popup.

This popup allows examination of the history of the record which is currently shown in the window. It has two main view modes which allow to examine the following data:

  • 'Record history' of a single record
  • 'Deleted records' of a single tab


The 'Record History' view

This view is displayed when the popup is opened from an existing record via the new toolbar button.

The top area always shows a reference to the entity (i.e. Sales Order) and the record "1000175 - 2016-04-03 00:00:00.0-0.00" for which the history is displayed.

Then a number of filters are available which allow some restriction on the changes displayed to ease the use for record with many modifications.

The grid in the lower area shows all changes done to this record while the audit trail feature was enabled. The changes are shown sorted from the most recent change back to earlier changes.

Note:

  • Only fields which are visible in the corresponding tab are shown here

A row in this grid corresponds to a single changed field. For changes to an existing record the number of grid entries shown correspond to the number of fields changed. For new record creations or record deletion one row in the grid is shown per field of the inserted/deleted record.

Audittrail popup.png

Finally a link just on top of the grid allow switching to the 'Deleted Records' view. Following that link will show deleted records for the tab from which the Audit Trail popup was opened.


The 'Deleted Records' view

This view allow examination of records which have been deleted from a tab and are otherwise no longer accessible in the user interface.

The general layout of the view is similar to the record history view.

An info on the top shows a reference to the entity for which the deleted records are shown. Directly below a number of filters is available to restrict the records shown.

Then a grid displays all deleted records belonging to this tab/entity. Here one row shown corresponds to a single deleted record and the columns shown are the same as the ones shown in the normal grid view of the same tab.


Full list of Audit Trail window fields and their descriptions is available in the Audit Trail Screen Reference.

Back button.png   Back to General Setup