Changing the default time and frequency of auditing archive and purge

Table of Contents 

Issue:

After enabling the audit logging feature, we noticed that the audit archiving runs every day at 1 am and the audit purging runs at 3am. 

We would like to change this so that it runs at a different time of the day. How can this be configured ?

 


 

Solution:

Configuring the audit archiving options can be done by editing the ./jasperserver-pro/WEB-INF/applicationContext-audit.xml file.

Locate the auditEventArchiverTrigger bean and modify the cron expression. 

Here is an example of a cron expression that will run the audit event archive at 2:10 pm every day :

    <bean id="auditEventArchiverTrigger" class="com.jaspersoft.jasperserver.api.engine.scheduling.quartz.JSCronTriggerBean">
        <property name="jobDetail" ref="auditEventArchiverJob"/>
        <property name="cronExpression" value="0 10 14 * * ?"/>
    </bean>

Similarly, if you want to modify the time and frequency for the audit event purge, locate the auditEventPurgerTrigger bean :

    <bean id="auditEventPurgerTrigger" class="com.jaspersoft.jasperserver.api.engine.scheduling.quartz.JSCronTriggerBean">
        <property name="jobDetail" ref="auditEventPurgerJob"/>
        <property name="cronExpression" value="0 0 3 * * ?"/>
    </bean>

Note that a restart of the TIBCO JasperReports® Server is required for any changes to take effect.

To understand the cron expression formats, there is a Format table in the Quartz documentation (See Reference link under 'Related Articles' below).

Extract of Format table from Quartz reference:

http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html

Feedback
randomness