Clearing the Audit Logs Automatically
Clearing the Audit Logs Automatically
OpenEMPI can be configured to audit all requests processed by the system. The default configuration causes all requests for adding or updating records to be audited but you may also configure the instance to audit requests that result in viewing of records managed by the instance. Audit records are persisted in the database and are by default preserved until they are manually deleted by the system administrator. Starting with the 3.5.1 release of OpenEMPI, you may configure the instance to automatically delete all audit records that are older than a specified amount of time. The configuration of this feature is very simple and we describe how to enable it here.
Enabling this feature requires that you first enable the auditRemoverTask to run periodically. To do that you must simply add the following scheduled task section to the list of scheduled tasks defined in the mpi-config.xml file.
 <scheduled-task schedule-type="schedule-at-fixed-rate" time-unit="seconds" entity-name="person"> <task-name>auditEventRemover</task-name> <task-implementation>auditEventRemover</task-implementation> <initial-delay>60</initial-delay> <period>60</period> </scheduled-task>
After restarting the server, this task will start 60 seconds after the server has started (initial-delay = 60 and time-unit is set to seconds in the example above) and will run every 60 seconds (period = 60 seconds). The default configuration of the auditEventRemover task is to delete any audit events from the database that are older than 90 days. You may change the age limit used by this task, by changing this configuration parameter in the applicationContext-services.xml file. The parameter eventExpirationDays controls the number of days that audit event entries will be preserved before being deleted from the server. The batchSize parameter controls how many audit event entries are deleted every time the auditEventRemover task is invoked. This is used to throttle the load generated by this process against a production instance.
 <bean id="auditEventRemover" class="org.openhie.openempi.service.impl.AuditEventRemover"> <property name="auditEventDao" ref="auditEventDao" /> <property name="username" value="${admin-user-username}"/> <property name="password" value="${admin-user-password}"/> <property name="batchSize" value="1000"/> <property name="eventExpirationDays" value="90"/> </bean>
Â
Â