文件 AWS 開發套件範例 GitHub 儲存庫中有更多可用的 AWS SDK 範例
本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
搭配使用 GetTrailStatus 與 CLI
下列程式碼範例示範如何使用 GetTrailStatus。
- CLI
-
- AWS CLI
-
取得追蹤的狀態
下列
get-trail-status命令傳回Trail1的交付和記錄詳細資訊:aws cloudtrail get-trail-status --nameTrail1輸出:
{ "LatestNotificationTime": 1454022144.869, "LatestNotificationAttemptSucceeded": "2016-01-28T23:02:24Z", "LatestDeliveryAttemptTime": "2016-01-28T23:02:24Z", "LatestDeliveryTime": 1454022144.869, "TimeLoggingStarted": "2015-11-06T18:36:38Z", "LatestDeliveryAttemptSucceeded": "2016-01-28T23:02:24Z", "IsLogging": true, "LatestCloudWatchLogsDeliveryTime": 1454022144.918, "StartLoggingTime": 1446834998.695, "StopLoggingTime": 1446834996.933, "LatestNotificationAttemptTime": "2016-01-28T23:02:24Z", "TimeLoggingStopped": "2015-11-06T18:36:36Z" }-
如需 API 詳細資訊,請參閱《AWS CLI 命令參考》中的 GetTrailStatus
。
-
- PowerShell
-
- Tools for PowerShell V4
-
範例 1:傳回名為 'myExampleTrail' 的追蹤狀態資訊。傳回的資料包含交付錯誤、Amazon SNS 和 Amazon S3 錯誤,以及開始和停止追蹤記錄時間的相關資訊。此範例假設追蹤是在與目前 shell 預設值相同的區域中建立的。
Get-CTTrailStatus -Name myExampleTrail範例 2:傳回在目前 shell 預設值 (在本案例中為法蘭克福 (eu-central-1) 區域) 以外區域中建立的追蹤狀態資訊。
Get-CTTrailStatus -Name myExampleTrail -Region eu-central-1-
如需 API 詳細資訊,請參閱《AWS Tools for PowerShell Cmdlet 參考 (V4)》中的 GetTrailStatus。
-
- Tools for PowerShell V5
-
範例 1:傳回名為 'myExampleTrail' 的追蹤狀態資訊。傳回的資料包含交付錯誤、Amazon SNS 和 Amazon S3 錯誤,以及開始和停止追蹤記錄時間的相關資訊。此範例假設追蹤是在與目前 shell 預設值相同的區域中建立的。
Get-CTTrailStatus -Name myExampleTrail範例 2:傳回在目前 shell 預設值 (在本案例中為法蘭克福 (eu-central-1) 區域) 以外區域中建立的追蹤狀態資訊。
Get-CTTrailStatus -Name myExampleTrail -Region eu-central-1-
如需 API 詳細資訊,請參閱《AWS Tools for PowerShell Cmdlet 參考 (V5)》中的 GetTrailStatus。
-
DescribeTrails
ListTrails