Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-11155

Having the ability to list the size of pages, spaces, attachments and etc being used in Confluence

    • 7
    • 15
    • We collect Confluence feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      NOTE: This suggestion is for Confluence Server. Using Confluence Cloud? See the corresponding suggestion.

      It will be useful if there is macro/plugin that can list the size of the pages, spaces, attachments, mail and etc being used in Confluence.

            [CONFSERVER-11155] Having the ability to list the size of pages, spaces, attachments and etc being used in Confluence

            Came across this issue.

            Attachment Checker for Confluence may address some of the issues

            Hope it is useful for those who needs these features

            Hua Soon SIM [Akeles] added a comment - Came across this issue. Attachment Checker for Confluence may address some of the issues Generate a summary of the attachment disk usage by space Track large attachments in Confluence Hope it is useful for those who needs these features

            That's because it counts each page's version as a separate page and also count pages in trash.
            So this is not definitely good way of counting real number of pages in space.

            Pavel Potcheptsov added a comment - That's because it counts each page's version as a separate page and also count pages in trash. So this is not definitely good way of counting real number of pages in space.

            Liz Canham added a comment -

            @Piyush Thanks for this useful macro.

            Does anyone know how this macro determines what a page is in order to get the page count? I tried it for one of my spaces, and it came up with 122, but the space only contains 24 pages!

            We do pull in content from other spaces though, which I didn't include in the count. Even so, for the size of space 122 pages is way too many. So I need to understand what the criteria is and how it determines what a page is. Thank you.

            Liz Canham added a comment - @Piyush Thanks for this useful macro. Does anyone know how this macro determines what a page is in order to get the page count? I tried it for one of my spaces, and it came up with 122, but the space only contains 24 pages! We do pull in content from other spaces though, which I didn't include in the count. Even so, for the size of space 122 pages is way too many. So I need to understand what the criteria is and how it determines what a page is. Thank you.

            Dempsey Ubeku added a comment - - edited

            tested and working ok

            Dempsey Ubeku added a comment - - edited tested and working ok

            Piyush added a comment -

            For Server version - We have a option (available to confluence admins) to add user macro in General Configuration page. Then that to be used in any location provided SPACE KEY.

            And Regarding BobSwift, that's really a great CLI to use with a 'good' amount

            Checkout: https://answers.atlassian.com/questions/48319/can-create-user-macros-in-the-ondemand-version

            Piyush added a comment - For Server version - We have a option (available to confluence admins) to add user macro in General Configuration page. Then that to be used in any location provided SPACE KEY. And Regarding BobSwift, that's really a great CLI to use with a 'good' amount Checkout: https://answers.atlassian.com/questions/48319/can-create-user-macros-in-the-ondemand-version

            No but I'm know no way to install this kind of script on Confluence Cloud. (Perhaps you can tell me how you would install it on Confluence Server, and I will try to see if it is feasible on Confluence Cloud)

            BTW I just found an add-on that would allow to write that kind of script :
            https://bobswift.atlassian.net/wiki/display/CSOAP

            Sebastien Ribiere added a comment - No but I'm know no way to install this kind of script on Confluence Cloud. (Perhaps you can tell me how you would install it on Confluence Server, and I will try to see if it is feasible on Confluence Cloud) BTW I just found an add-on that would allow to write that kind of script : https://bobswift.atlassian.net/wiki/display/CSOAP

            Piyush added a comment -

            I'm unaware about the Confluence Cloud status.
            That failed?

            Piyush added a comment - I'm unaware about the Confluence Cloud status. That failed?

            This macro seems interesting.
            But it seems unusable on Confluence Cloud. Am I wrong?

            Sebastien Ribiere added a comment - This macro seems interesting. But it seems unusable on Confluence Cloud. Am I wrong?

            Piyush added a comment - - edited

            I found out this macro which gives 95% of exact space storage status

            // Some comments here
            ## Macro title: Space Meta Data 2
            ## Macro has a body: Y or N (N)
            ## Body processing: Selected body processing option
            ## Output: Selected output option
            ##
            ## Developed by: Matthew Horn, based on Space Meta Data by Andrew Frayling
            ## Date created: 06/07/2012
            ## Installed by: <your name>
            ## Macro to display information such as number of pages, number of blog posts, attachment size, etc. about a named Space.
            ## @param TargetSpace:title=Target space|type=string|desc=Enter the KEY of the space you want metadata for. For example, coredoc, gscontent, samples, wncontent|required=true|multiple=false
            ## Get space details
            #set ( $targetSpace = $spaceManager.getSpace($paramTargetSpace) )
            #set ( $spaceName = $targetSpace.getName() )
            #set ( $spaceKey = $targetSpace.getKey() )
            #set ( $spaceHome = $targetSpace.getHomePage() )
            #set ( $spaceCreator = $targetSpace.getCreatorName() )
            #set ( $spaceCreationDate = $targetSpace.getCreationDate() )
            #set ( $spaceDescription = $targetSpace.getDescription() )
            #set ( $pageCount = $spaceManager.findPageTotal($targetSpace) )
            #set ( $blogCount = $spaceManager.getNumberOfBlogPosts($targetSpace) )
             
            ## Get all pages in the current Space
            #set ( $allPagesInSpace = $pageManager.getPages($targetSpace, true) )
            ## Reset total attachment file size
            #set ( $totalAttachmentFileSizeForSpace = 0 )
            ## Reset total number of attachments
            #set ( $totalAttachmentCount = 0 )
            ## Loop through all pages in the current Space
            #foreach ($page in $allPagesInSpace)
              ## reset the attachment count for each page
              #set ( $pageAttachmentCount = 0 )
              ## reset the attachment file size total for each page
              #set ( $totalFileSizePerPage = 0 )
              ## get the attachments for each page
              #set ( $allAttachments = $page.getAttachments() )
              ## Loop through each attachment
              #foreach ($attachment in $allAttachments)
                ## Increment the attachment count for the page
               #set ( $pageAttachmentCount = $pageAttachmentCount + 1 )
                ## Sum the size of the attachments on the page
                #set ( $totalFileSizePerPage = $totalFileSizePerPage + $attachment.getFileSize() )
              #end
              ## End looping through attachments
              ## Increment total attachment count for the current Space
              #set ( $totalAttachmentCount = $totalAttachmentCount + $pageAttachmentCount )
              ## Sum the total size of attachments for the current Space
              #set ( $totalAttachmentFileSizeForSpace = $totalAttachmentFileSizeForSpace + $totalFileSizePerPage )
            #end
            ## End looping through pages
             
            ## Convert attachment size to MBs
            #set ( $attachmentSizeMb = ($totalAttachmentFileSizeForSpace / 1024.00) / 1024.00 )
             
            ## Display Space Details
            <table class="confluenceTable">
              <tbody>
                <tr>
                  <th class="confluenceTh">Name</th>
                  <td class="confluenceTd">$spaceName</td>
                </tr>
                <tr>
                  <th class="confluenceTh">Key</th>
                  <td class="confluenceTd">$spaceKey</td>
                </tr>
                <tr>
                  <th class="confluenceTh">Description</th>
                  <td class="confluenceTd">$spaceDescription.getBodyAsString()</td>
                </tr>
                <tr>
                  <th class="confluenceTh">Home Page</th>
                  <td class="confluenceTd">#contentLink2($spaceHome true false)</td>
                </tr>
                <tr>
                  <th class="confluenceTh">Created By</th>
                  <td class="confluenceTd">#usernameLink($spaceCreator) ($action.dateFormatter.formatDateTime($spaceCreationDate))</td>
                </tr>
                <tr>
                  <th class="confluenceTh">Number of Pages</th>
                  <td class="confluenceTd">$pageCount</td>
                </tr>
                <tr>
                  <th class="confluenceTh">Number of Blog Posts</th>
                  <td class="confluenceTd">$blogCount</td>
                </tr>
                <tr>
                  <th class="confluenceTh">Number of Attachments</th>
                  <td class="confluenceTd">$totalAttachmentCount (including all versions)</td>
                </tr>
                <tr>
                  <th class="confluenceTh">Total Size of Attachments</th>
                  <td class="confluenceTd">$attachmentSizeMb MB</td>
                </tr>
              </tbody>
            </table>
            
            

            Piyush added a comment - - edited I found out this macro which gives 95% of exact space storage status // Some comments here ## Macro title: Space Meta Data 2 ## Macro has a body: Y or N (N) ## Body processing: Selected body processing option ## Output: Selected output option ## ## Developed by: Matthew Horn, based on Space Meta Data by Andrew Frayling ## Date created: 06/07/2012 ## Installed by: <your name> ## Macro to display information such as number of pages, number of blog posts, attachment size, etc. about a named Space. ## @param TargetSpace:title=Target space|type=string|desc=Enter the KEY of the space you want metadata for. For example, coredoc, gscontent, samples, wncontent|required=true|multiple=false ## Get space details #set ( $targetSpace = $spaceManager.getSpace($paramTargetSpace) ) #set ( $spaceName = $targetSpace.getName() ) #set ( $spaceKey = $targetSpace.getKey() ) #set ( $spaceHome = $targetSpace.getHomePage() ) #set ( $spaceCreator = $targetSpace.getCreatorName() ) #set ( $spaceCreationDate = $targetSpace.getCreationDate() ) #set ( $spaceDescription = $targetSpace.getDescription() ) #set ( $pageCount = $spaceManager.findPageTotal($targetSpace) ) #set ( $blogCount = $spaceManager.getNumberOfBlogPosts($targetSpace) )   ## Get all pages in the current Space #set ( $allPagesInSpace = $pageManager.getPages($targetSpace, true) ) ## Reset total attachment file size #set ( $totalAttachmentFileSizeForSpace = 0 ) ## Reset total number of attachments #set ( $totalAttachmentCount = 0 ) ## Loop through all pages in the current Space #foreach ($page in $allPagesInSpace)   ## reset the attachment count for each page   #set ( $pageAttachmentCount = 0 )   ## reset the attachment file size total for each page   #set ( $totalFileSizePerPage = 0 )   ## get the attachments for each page   #set ( $allAttachments = $page.getAttachments() )   ## Loop through each attachment   #foreach ($attachment in $allAttachments)     ## Increment the attachment count for the page    #set ( $pageAttachmentCount = $pageAttachmentCount + 1 )     ## Sum the size of the attachments on the page     #set ( $totalFileSizePerPage = $totalFileSizePerPage + $attachment.getFileSize() )   #end   ## End looping through attachments   ## Increment total attachment count for the current Space   #set ( $totalAttachmentCount = $totalAttachmentCount + $pageAttachmentCount )   ## Sum the total size of attachments for the current Space   #set ( $totalAttachmentFileSizeForSpace = $totalAttachmentFileSizeForSpace + $totalFileSizePerPage ) #end ## End looping through pages   ## Convert attachment size to MBs #set ( $attachmentSizeMb = ($totalAttachmentFileSizeForSpace / 1024.00) / 1024.00 )   ## Display Space Details <table class= "confluenceTable" >   <tbody>     <tr>       <th class= "confluenceTh" > Name </th>       <td class= "confluenceTd" > $spaceName </td>     </tr>     <tr>       <th class= "confluenceTh" > Key </th>       <td class= "confluenceTd" > $spaceKey </td>     </tr>     <tr>       <th class= "confluenceTh" > Description </th>       <td class= "confluenceTd" > $spaceDescription.getBodyAsString() </td>     </tr>     <tr>       <th class= "confluenceTh" > Home Page </th>       <td class= "confluenceTd" > #contentLink2($spaceHome true false) </td>     </tr>     <tr>       <th class= "confluenceTh" > Created By </th>       <td class= "confluenceTd" > #usernameLink($spaceCreator) ($action.dateFormatter.formatDateTime($spaceCreationDate)) </td>     </tr>     <tr>       <th class= "confluenceTh" > Number of Pages </th>       <td class= "confluenceTd" > $pageCount </td>     </tr>     <tr>       <th class= "confluenceTh" > Number of Blog Posts </th>       <td class= "confluenceTd" > $blogCount </td>     </tr>     <tr>       <th class= "confluenceTh" > Number of Attachments </th>       <td class= "confluenceTd" > $totalAttachmentCount (including all versions) </td>     </tr>     <tr>       <th class= "confluenceTh" > Total Size of Attachments </th>       <td class= "confluenceTd" > $attachmentSizeMb MB </td>     </tr>   </tbody> </table>

            Piyush added a comment -

            Was this ever reviewed?

            Piyush added a comment - Was this ever reviewed?

              Unassigned Unassigned
              mgchong Ming Giet Chong [Atlassian]
              Votes:
              90 Vote for this issue
              Watchers:
              54 Start watching this issue

                Created:
                Updated: