获取审核日志API查询时间不正确

时间:2019-05-30 02:41:29

标签: ibm-cloud-infrastructure

当我使用审核日志API时。有一些问题让我感到困惑。 总结: 如果要获取创建时间为2019-05-28T03:28:25.179934-00:00的审核日志,则应使用2019-05-27T22:24:24.426227-00:00进行查询。

我使用此API查询了5个结果限制的审核日志:

curl -s  -g 'https://api.softlayer.com/rest/v3.1/SoftLayer_Event_Log/getAllObjects.json?objectMask=mask[eventCreateDate,eventName]&resultLimit=0,5' -H "Authorization: $t" | jq . 
[
  {
    "eventCreateDate": "2019-05-28T11:30:01.497045+08:00",
    "eventName": "Login Successful"
  },
  {
    "eventCreateDate": "2019-05-28T11:28:25.179934+08:00",
    "eventName": "Login Successful"
  },
  {
    "eventCreateDate": "2019-05-28T11:26:18.571162+08:00",
    "eventName": "Login Successful"
  },
  {
    "eventCreateDate": "2019-05-28T11:24:24.426227+08:00",
    "eventName": "Login Successful"
  },
  {
    "eventCreateDate": "2019-05-28T11:22:44.593298+08:00",
    "eventName": "Login Successful"
  }
]

现在,我想查询第二个到第四个的审核日志。 基于服务器响应。查询时间应在2019-05-28T11:24:24.426227+08:002019-05-28T11:28:25.179934+08:00之间。 (已编辑)

但是服务器返回null并显示以下查询:

curl -s -g'https://api.softlayer.com/rest/v3.1/SoftLayer_Event_Log/getAllObjects.json?objectMask=mask[eventCreateDate,eventName]&resultLimit=0,5&objectFilter= {“ eventCreateDate”:{“ operation”:“ betweenDate”,“ options”:[{“ name”:“ startDate”,“ value”:[“ 2019- 05-28T11:24:24.426227 + 08:00“]},{”名称“:” endDate“,”值“:[” 2019-05-28T11:28:25.179934 + 08:00“]}]}}}' -H“授权:$ t” | jq。 空

问题是,如果我在2019-05-27T23:24:24.426227+01:002019-05-27T23:24:24.426227+01:00之间使用时间查询。 或介于2019-05-27T22:24:24.426227-00:002019-05-27T22:28:25.179934-00:00之间。服务器将返回这三个我想要获取的审核日志:

curl -s  -g 'https://api.softlayer.com/rest/v3.1/SoftLayer_Event_Log/getAllObjects.json?objectMask=mask[eventCreateDate,eventName]&resultLimit=0,5&objectFilter={"eventCreateDate":{"operation":"betweenDate","options":[{"name":"startDate","value":["2019-05-27T21:24:24.426227-01:00"]},{"name":"endDate","value":["2019-05-27T21:28:25.179934-01:00"]}]}}' -H "Authorization: $t" | jq .
[
  {
    "eventCreateDate": "2019-05-28T11:28:25.179934+08:00",
    "eventName": "Login Successful"
  },
  {
    "eventCreateDate": "2019-05-28T11:26:18.571162+08:00",
    "eventName": "Login Successful"
  },
  {
    "eventCreateDate": "2019-05-28T11:24:24.426227+08:00",
    "eventName": "Login Successful"
  }
]

curl -s  -g 'https://api.softlayer.com/rest/v3.1/SoftLayer_Event_Log/getAllObjects.json?objectMask=mask[eventCreateDate,eventName]&resultLimit=0,5&objectFilter={"eventCreateDate":{"operation":"betweenDate","options":[{"name":"startDate","value":["2019-05-27T22:24:24.426227-00:00"]},{"name":"endDate","value":["2019-05-27T22:28:25.179934-00:00"]}]}}' -H "Authorization: $t" | jq .
[
  {
    "eventCreateDate": "2019-05-28T11:28:25.179934+08:00",
    "eventName": "Login Successful"
  },
  {
    "eventCreateDate": "2019-05-28T11:26:18.571162+08:00",
    "eventName": "Login Successful"
  },
  {
    "eventCreateDate": "2019-05-28T11:24:24.426227+08:00",
    "eventName": "Login Successful"
  }
]

将查询时间2019-05-27T23:24:24.426227+01:002019-05-27T22:24:24.426227-00:00转换为UTC时间的结果应为2019-05-27T22:24:24.426227-00:00。对吧?

但是将2019-05-28T11:28:25.179934+08:00转换为UTC的结果是2019-05-28T03:28:25.179934-00:00

他们有-5小时的偏移量。这意味着如果我想获取创建时间为2019-05-28T03:28:25.179934-00:00的审核日志,则应该使用2019-05-27T22:24:24.426227-00:00进行查询。

0 个答案:

没有答案