Install the attached package to the CQ5 package manager.
Purge workflow and audit nodes
CQ5 workflows and audit events generate much archived data. This data can quickly grow over time due to replications, DAM uploads, and other system activities.
Clean up completed and aborted workflows on a regular basis.
With the attached sample purge service, you can run a purge of this data on a regular schedule.
Define a time range for every day (for example, 22H00-23H00) automatic cleanup.
If necessary, you can define a list of workflow models for which workflow instances can be removedif found running for more than one day. (Usually, this list applies to models containing only a process step.)
Or, you can define the list of workflow models for which workflow instances can be restarted if found running for more than one day.
See the Apache Felix configuration panel and the purge service for details. In your browser, go to http://cqhost:cqport/system/console/configMgr. (cqhost is the host name of your CQ instance and cqport is the port number of your CQ instance.)
You can start a purge manually by creating a file ./cleanWorkflow. Then, the watch service detects the file and starts a purge.
To stop the purge, delete the file cleanWorkflow.now. This file is removed when the purge is completed. Source code is available in the package. Customize it based on your requirements.
Added also since the version 1.6.5, is an audit purge process that keeps the last 60 days worth of audit entries. (You configure it in the Apache Felix Webconsole.) You can start it via the user interface, or with a ./cleanAudit file in the working directory.
The attached file is a CRX content package from 5.4, and can show a warning if you install it on a different version. However, it should still work.
Disclaimer: This tool is based on a custom implementation, and is not part of the official product. Use it with caution. Source is included so you can adapt it to your need in case of any specific requirements.
Note for Experience Manager 5.6+: For Workflow Purge you can use the product built-in feature accessible via JMX and configurable Scheduler. JMX: /system/console/jmx/com.adobe.granite.workflow%3Atype%3DMaintenance
Note for Experience Manager 6.0: you can now use the built-in workflow purge, and so only use the audit purge from that tool.
Changes December 28 2012: fixed for restart workflow bundle only if nodes got removed, changed tool location to /etc/workflow/purge and using CQ 5.5 / 5.6 style for the page layout (based on the version purge layout).
Changes May 6 2013: compiled against JDK 1.5 for older CQ compatibility, changed logs messages in audit purge to match with defined max days.