CQ5 workflows and audit events generate
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.
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.