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

Bernardo San Juan 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-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 18, 2016
3 votes
Bob Swift OSS (Bob Swift Atlassian Apps)
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 May 4, 2016

Many thks to both. Ill go for that

0 votes
Bernardo San Juan 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
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
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
TAGS
AUG Leaders

Atlassian Community Events