【问题标题】:Softlayer: IBM Cloud: API calls to search and retrieve Account > Audit LogSoftlayer:IBM Cloud:用于搜索和检索帐户 > 审计日志的 API 调用
【发布时间】:2020-03-27 03:06:45
【问题描述】:

我正在寻找一种通过 API 调用在 IBM Cloud 中查询“帐户 > 审计日志”的方法。基本上,这里提供的信息https://cloud.ibm.com/account/audit-log 是从脚本中检索和搜索的。谁能分享一个相关的例子?

【问题讨论】:

    标签: api logging ibm-cloud-infrastructure


    【解决方案1】:

    要检索审核日志,您可以使用SoftLaye_Event_Log::getAllObjects

    下面是使用 REST API 调用获取日志的示例:

    Method: GET
    
    https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Event_Log/getAllObjects.json?resultLimit=0,50 
    

    注意:上面的 resultLimit 检索最后 50 个事件。

    对于事件日志,建议使用过滤器来限制您搜索事件的时间,否则您可能会在很长时间内对事件进行分页。

    以下示例使用 REST API 调用获取按日期过滤的日志:

    Method: GET 
    
    https://[username]:[apikey]@api.softlayer.com/rest/v3.1/SoftLayer_Event_Log/getAllObjects.json?resultLimit=0,50&objectFilter={"eventCreateDate":{"operation":"greaterThanDate","options":[{"name":"date","value":["2020-03-16T00:00:00.0000-06:00"]}]}}&objectMask=mask[eventName,label,eventCreateDate]
    

    参考资料:

    https://sldn.softlayer.com/python/event_log/

    https://sldn.softlayer.com/article/object-filters/

    https://sldn.softlayer.com/article/object-masks/

    https://sldn.softlayer.com/article/using-result-limits-softlayer-api/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-08-15
      • 1970-01-01
      • 2021-10-04
      • 2012-08-31
      • 2018-01-27
      • 2023-04-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多