日志下载
查询完整数据的流程: 1. 第一次查询cursor设置为"", 2. 返回的数据cursor不为""则再次发起查询,请求带上上次查询返回的cursor值 3. 重复步骤2,直到返回的cursor=""
#!/bin/bash username="example_username" apiKey="example_apiKey" date=`env LANG="en_US.UTF-8" date -u "+%a, %d %b %Y %H:%M:%S GMT"` password=`echo -en "$date" | openssl dgst -sha1 -hmac $apiKey -binary | openssl enc -base64` #请填写账号和apiKey,将根据apiKey和date生成password curl -i --url "https://open.chinanetcenter.com/api/logd/v2/query/oppo" -X "POST" -u "$username:$password" -H "Date: $date" -H "Accept: application/json" \ -d '{ "startTime": 1663516800000, "endTime": 1663603200000, "filter": { "prefixes": ["/videoclipfsg.coloros.com", "/ota-manual-in.allawnofs.com"], "nameGlob": "" }, "cursor": "", "limit": 1 }'
{ "count": 1, "cursor": "Ac07nQMWBAgFEgYABwAIAAk7AM8AAAA8wacN4AA=", "files": [{ "http_url": "http://logdcenter.chinanetcenter.com/logd/v2/download/0422c8c1085ccb5a9c71403601ddd5c7e68d", "https_url": "https://logdcenter.chinanetcenter.com/logd/v2/download/0422c8c1085ccb5a9c71403601ddd5c7e68d", "url_expire_time": 1663769641572, "file_begin_time": 1663516800000, "file_end_time": 1663520399999, "file_timezone": 8, "file_path": "/videoclipfsg.coloros.com/2022-09-19/2022-09-19-0000-0059_videoclipfsg.coloros.com.log.0.gz", "file_name": "2022-09-19-0000-0059_videoclipfsg.coloros.com.log.0.gz", "file_length": 33280259, "file_key": "0422c8c1085ccb5a9c71403601ddd5c7e68d", "file_md5": "", "file_timeout": false, "dimensions": { "domain": "videoclipfsg.coloros.com" } }] }