Implementing Demantra Audit Log
Implementing Demantra Audit Log
Audit logging of Demantra metadata configuration changes can be extremely useful for tracking data
model changes by date and user, particularly in the areas of Sarbanes-Oxley (SOX) compliance. This
audit logging of Demantra metadata configuration changes can be achieved via database triggers.
The approach outlined in this document would support logging configuration changes made using
Business Modeler as well as any type of backend change made to the data model outside of standard
tools.
Logging can include session information, user’s information and object configuration changes to Series,
Levels, Integration Interfaces, etc. The Audit can track the user who has made the changes as well as
logging old and new values.
This process should not modify any internal Demantra tables; information should be logged to a
standalone table which will be described below.
Business Modeler stores Demantra session information in table SESSIONS. This will include the login /
logout activity time and Demantra USER_ID.
In order to have a more detailed log we can capture Oracle session variables and save them to the
SESSIONS table. Common session variables that can be added to any trigger or SQL are: SID, HOST,
MODULE, OS_USER:
The following trigger will capture and store the above information in Demantra SESSIONS table.
CREATE OR REPLACE
TRIGGER audit_sessions
BEFORE INSERT OR UPDATE ON sessions
FOR EACH ROW
WHEN ( new.session_id > 0)
DECLARE
PRAGMA AUTONOMOUS_TRANSACTION;
user_id number;
BEGIN
COMMIT;
END IF;
END;
/
A generic stand alone table can be used to log all audit information using the AUDIT_SESSIONS
trigger above and any additional triggers for other objects. Below is a generic table structure
that can capture detailed information on user activity.
This table is not part of a standard Demantra schema; this is implemented separately
depending on requirements.
Series, Levels and other object changes can be audited using information stored in Demantra
tables, Oracle session environment “SYS_CONTEXT” and the Demantra SESSIONS table. This can
be accomplished by cross checking the SYS_CONTEXT SID column with Demantra SESSIONS
SID_NUM column.
For example: Create trigger on COMPUTED_FIELDS table (for Series definitions) and log activity
to AUDIT_LOG table and capture history of modifications.
The following trigger on the COMPUTED_FIELDS table will capture changes to series titles and
series client expressions and log the changes to AUDIT_LOG table.
create or replace
TRIGGER audit_series
BEFORE INSERT OR UPDATE ON computed_fields
FOR EACH ROW
DECLARE
PRAGMA AUTONOMOUS_TRANSACTION;
u_id number := -1;
BEGIN
/**
* Audit series changes in Internal Name, Series Title or Client Expression changes
**/
commit;
END;
/
AUDIT_LOG Table with log information: