Useful JQLs for selecting issues for housekeeping
To effectively manage and review attachments, Jira Query Language (JQL) can be used to find issues with attachments. We have listed the common scenarios with their JQL condition below.
You can craft more advanced queries by combining the scenarios below
Recommended query
The most common query used by most team for housekeeping will be to strip attachments from
- resolved (or closed) issues 
- resolved more than 5 calendar years and 
- not updated for the last 5 calendar years 
resolution is not empty AND resolutiondate <= endOfYear(-5) AND updated <= endOfYear(-5)Here are other typical JQL queries:
- Find all issues within project XYZ CODE- project = XYZ
- Find all issues with attachments CODE- attachments is not empty
- Find issues that have not been updated in the last 12 months CODE- updated <= startOfMonth(-12)
- Find issues that has been resolved with resolution date before 11/Mar/2020 CODE- resolution is not empty AND resolutiondate < "2020/03/11"
- Find issues of a specific issue type (Test Cases) CODE- issuetype = test
- Find issues tagged with a ‘gdpr’ label CODE- labels = gdpr
Conclusion
The JQL can only be used to filter the issues for housekeeping.
It is possible to specify additional rules in the housekeeping policy on the attachments such as 
- File Size 
- File Extension 
- Mentioned in description/comments 
