Softlayer:IBM Cloud:用于搜索和检索帐户>审计日志的API调用

问题描述 投票:0回答:1

我正在寻找一种通过API调用在IBM Cloud中查询“帐户>审核日志”的方法。基本上,此信息在此处https://cloud.ibm.com/account/audit-log可用,但可从脚本中检索和搜索。任何人都可以分享相关示例吗?

api logging ibm-cloud-infrastructure
1个回答
0
投票

要检索审核日志,您可以使用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/

© www.soinside.com 2019 - 2024. All rights reserved.