Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Query issues with attachment sorted by size is that possible??

Bernardo San Juan
Contributor
May 4, 2016

 

Dear Answers community,

We need to archive a whole lot of attachments load. We are hitting storage limit and want to start solving this issue. We will archive some issues and projects but I would also want to have a good criteria to search for issue with a lot of load.

For that I used JQL: "attachments is not empty"

But I can not know what is the size of the attachment. Any suggestion on how to solve this case? I want to have a list of issues with attachments, this list should included attachment size.

Cheers

 

7 answers

1 accepted

0 votes
Answer accepted
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 4, 2016

You will definitely need some code to enable this - something that can go into an issue, check the attachments and display the size. 

Francis is right in that the Script Runner could give you a scripted field that could display the total size of all attachments on an issue, and it's only a few lines of code.

But there's no Script Runner on Cloud, and the restrictions mean that you can't add similar add-ons either.

But, two other options

  1. Write a Connect add-on that can fetch the attachment sizes
  2. Do it externally - run your filter over REST and iterate through the results, pulling the attachment meta-data down over REST.

Both of those would use https://docs.atlassian.com/jira/REST/latest/#api/2/attachment-getAttachment

 

 

Deleted user November 17, 2016

Hi Nic

Sorry for reviving old threads, but you always seem to be able to help me in here smile

I could really use a script (for ScriptRunner), that can tell me the attachment size per Issue. I managed to find one that gives me number of attachments, but that doesnt really help me unfortunately. 

Hopefully you'll see this,

Best regards Nikolaj 

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 18, 2016
3 votes
Bob Swift
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 4, 2016

The following action from JIRA Command Line Interface (CLI) will give you a CSV file of issues and attachments with size:

--action runFromIssueList --jql "project = XXX" --common "--action getAttachmentList --issue @issue@ --file attachmentList.csv --append --outputFormat 2" --clearFileBeforeAppend
0 votes
Deleted user November 17, 2016

Hi Francis,

 
I am looking for exactly a script like that, but I can't get it to work. How would you write it? 

0 votes
Pablo Beltran
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 4, 2016

SQL for JIRA is also an option as the ISSUEATTACHMENTS table supports FILESIZE 

0 votes
Bernardo San Juan
Contributor
May 4, 2016

Many thks to both. Ill go for that

0 votes
Bernardo San Juan
Contributor
May 4, 2016

Hi Francis,

 

No, did not consider that. I want to know if there is other approaches rather than recurring to scripts. However, thks for your quick reply, I may give it a try if no other option.

0 votes
francis
Atlassian Partner
May 4, 2016

Did you consider a scripted field (script runner) which is set with the total size of all attachments related to an issue ?

 

Suggest an answer

Log in or Sign up to answer