Over time the number of attachment versions might grow infinitely. Space Admin provides a service to delete selected attachment versions on a regular basis by configuring a Cron expression for each service.
The attachment cleanup service can be reached via the Confluence administration → Space Admin → Attachment cleanup service:
On this page all created services will be listed in combination with the following information:
- Date of creation
- Cron expression
- Current status (enabled/disabled)
Configuring a new cleanup service
Upon clicking on "Add attachment cleanup service" in the upper right-hand corner a new cleanup service can be configured.
The following options can be configured:
This option is mandatory.
Give your attachment service a meaningful name.
|Description||Describe what your attachment service is doing.|
This option is mandatory.
Enter a valid Cron expression. Some basic examples can be found below.
|Spaces, Pages, Attachments||
SINCE VERSION 2.3.0, it is also possible to select all spaces at once!
Select, which spaces, pages, or attachments should be searched for cleaning the attachment versions.
The items selected in Spaces, Pages, and Attachments will be OR linked. So no matter which attachment is selected, if a space is selected, all attachment versions in this space will be cleaned up. The specified attachment will be cleaned additionally.
|Cleanup mode||Select whether you want to keep a specific amount of attachment versions, or specify a minimum number of days a version must be present in the system before it will be deleted.|
Handy cron expressions
The following cron expressions might be useful when setting up a new attachment service:
|0 0 1 1 1/1 ? *||The service will be executed on every first day of each month at 01:00 am.|
|0 0 1 ? * 2 *||The service will be executed each Monday every week at 01:00 am.|
|0 0 1 1/14 * ? *|
The service will be executed every 14 days in a month, starting on the first day of each month at 01:00 am.
Note: This job will always be executed on the 1st, the 14th and depending on the days in the month on the 29th and then again on the 1st of the next month.
|0 0 1/12 ? * * *||This service will be executed every 12 hours on each day starting at 01:00 am.|
Previewing a cleanup service
It is also possible to preview a cleanup. By clicking on the "Preview" button in the cleanup service, a preview of versions to be deleted will be displayed:
On the opening page the versions to be deleted will be listed.
This page always displays a maximum of 100 random results from the cleanup job. The exact number of versions can be seen in the top alert box.