Download Access Logs

Last updated: 2019-11-29 17:58:59

    API Description

    This API (GetDsaHostLogs) is used to query log download URLs for domain names.
    Domain name: dsa.api.qcloud.com

    Note:

    • A maximum of 100 calls to this API are allowed per minute.
    • This API can query log download URLs for up to 10 domain names at a time.
    • Logs are packaged and the download URLs are generated with a granularity of one hour by default.
    • A log download URL is valid for 24 hours and needs to be queried once again if expired.
    • If no access log is generated for an hour during the query period, no download URL will be generated.
    • Logs are queried on a per-day basis and you can obtain access logs generated over the last 40 days.
    • It takes a while to collect access logs, which cannot be collected across the platform until they have been generated for two hours.

    Request Parameters

    The following request parameter list only provides API request parameters. Common request parameters are required when the API is called.. The Action field for this API is GetDsaHostLogs.

    Parameter Required Type Value Example Description
    hosts Yes String ["dsatest.qcloud.com"] Lists domain names, submitted in JSON format
    For more information, please see Sample Code
    startDate No String 2018-04-19 Start time,
    format: YY-MM-DD
    endDate No String 2018-04-19 End time,
    format: YY-MM-DD

    Parameter description:

    • When the start time or the end time is empty, the log download URLs of the day is returned by default.
    • When querying multiple domain names simultaneously, you are recommended to use the POST method for submission, so as to prevent the URL length from exceeding the limit.

    Response Parameters

    Parameter Type Description
    code Int Common error code
    0: Successful
    Other values: Failed
    For more information, please see Common Error Codes on the Error Codes page
    message String Module error message description depending on API
    codeDesc String Error message or error code at business side
    data Object Data on log download URLs, which is displayed by domain name. For more information, please see data Field Description

    data Field Description

    Parameter Type Description
    Query domain names Array Detailed log download URLs for domain names. For more information, please see Description of the Detailed Log Download URLs for Domain Names field

    Parameter Description:
    When more than one domain name is queried, the log download URL for each domain name is displayed separately in an array, which is of the same name as the domain.
    When the log download URLs for the domain names a.dsa.qcloud.com and b.dsa.qcloud.com are queried simultaneously, then the log URL arrays "a.dsa.qcloud.com" and "b.dsa.qcloud.com" are contained in the returned data.

    Description of the Detailed Log Download URLs for Domain Names field

    Parameter Type Description
    datetime String Log period
    For example: 2018-04-19 12:00:00
    url String Log download URLs in the corresponding period

    Sample Code

    Configuration example

    Query the log download URLs for the domain names a.dsa.qcloud.com and b.dsa.qcloud.com on 2018-04-18.

    GET Request

    To prevent the URL length from exceeding the limit due to an overlong query parameter, this API is called to submit query requests using the POST method by default.

    POST Request

    For a POST request, the parameters are input in HTTP Request-body. The request address is:

    https://dsa.api.qcloud.com/v2/index.php  

    Formats such as form-data and x-www-form-urlencoded are supported for the parameters. The array of parameters is as follows:

    array (
      'Action' => 'GetDsaHostLogs',
      'SecretId' => 'SecretId',
      'Timestamp' => 1507805426982,
      'Nonce' => 123456789,
      'Signature' => 'Signature',
      'hosts' => '["a.dsa.qcloud.com","b.dsa.qcloud.com"]',
      'startDate' => '2018-04-18', 
      'endDate' => '2018-04-18'
    )

    Example of returned result

    Query Successful

    {
        "code": 0,
        "message": "",
        "codeDesc": "Success",
        "data": {
            "a.dsa.qcloud.com": [
                {
                    "datetime": "2018-04-18 00:00:00",
                    "url": "http://dsa-log-download.cdn.qcloud.com/20180418/00/20180418-a.dsa.qcloud.com?st=XBkcH5nGvXSCKqZcdNLORg&e=1508669326"
                },
                ......
                {
                    "datetime": "2018-04-18 23:00:00",
                    "url": "http://dsa-log-download.cdn.qcloud.com/20180418/23/20180418-a.dsa.qcloud.com?st=CtkcH5VGvXDCKqZcdgLORE&e=1108623346"
                }
            ],
            "b.dsa.qcloud.com":[
                {
                    "datetime": "2018-04-18 00:00:00",
                    "url": "http://dsa-log-download.cdn.qcloud.com/20180418/00/20180418-b.dsa.qcloud.com?st=XBkcH5nGvXSCKqZcdNLORg&e=1508069326"
                },
                ......
                {
                    "datetime": "2018-04-18 23:00:00",
                    "url": "http://dsa-log-download.cdn.qcloud.com/20180418/23/20180418-b.dsa.qcloud.com?st=CtkcH5VGvXDCKqZcdgLORE&e=3108623346"
                }
            ]
        }
    }

    Query Failed

    {
        "code": 4100,
        "message": "Authentication failed. For more information, please see the Authentication section in the document.",
        "codeDesc": "AuthFailure"
    }

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help