Search code examples
ibm-cloudopenstackobject-storage

total size and total number of object in IBM Bluemix object store


I'm using an IBM Bluemix Object Store. Now I want to know how many files are in the object store and what the total size of these object are within a container.

When I try to get the info of a container (/v1/​{account}​/​{container}​) I only get the objects back with a maximum of 10000 objects.

Is the an other URL which I have to use to get the total number of objects and the total size of a container.

Arjan


Solution

  • The following curl command will return you an array of JSON objects, where each object has the following details of your containers:

    • Number of objects (files)
    • Total size in bytes
    • Name of the container

      curl -i https://dal.objectstorage.open.softlayer.com/v1/{account}?format=json -X GET -H "X-Auth-Token: xxxxx"

    It returns the following information (see last line for the array of JSON objects, but information in available in the header as well):

    HTTP/1.1 200 OK
    Content-Length: 143
    X-Account-Object-Count: 6
    X-Account-Storage-Policy-Standard-Container-Count: 3
    X-Timestamp: 1462461311.74826
    X-Account-Meta-Temp-Url-Key: xxxxxx
    X-Account-Storage-Policy-Standard-Object-Count: 6
    X-Account-Bytes-Used: 8767182
    X-Account-Container-Count: 3
    Content-Type: application/json; charset=utf-8
    Accept-Ranges: bytes
    X-Account-Storage-Policy-Standard-Bytes-Used: 8767182
    x-account-project-domain-id: xxxxxx
    Date: Wed, 18 May 2016 01:31:01 GMT
    
    [{"count": 1, "bytes": 7873373, "name": "logs"}, {"count": 3, "bytes": 378749, "name": "test"}, {"count": 2, "bytes": 515060, "name": "test2"}]
    

    Please note I masked some sensitive data above for security reasons.

    You can see the curl command below when you run swift cli in debug mode:

    $ swift --debug list -lt
    

    If you need more information about how to setup swift cli for your Object Storage see the documentation in the link below:

    https://new-console.eu-gb.bluemix.net/docs/services/ObjectStorage/objectstorge_usingobjectstorage.html#using-swift-cli