CLI로 GetTrailStatus 사용 - AWS SDK 코드 예제

AWS SDK 예제 GitHub 리포지토리에 더 많은 AWS문서 SDK 예제가 있습니다.

CLI로 GetTrailStatus 사용

다음 코드 예시는 GetTrailStatus의 사용 방법을 보여 줍니다.

CLI
AWS CLI

추적 상태를 가져오는 방법

다음 get-trail-status 명령은 Trail1에 대한 전송 및 로깅 세부 정보를 반환합니다.

aws cloudtrail get-trail-status --name Trail1

출력:

{ "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 오류, 추적의 로깅 시작 및 중지 시간에 대한 정보가 포함됩니다. 이 예제에서는 추적이 현재 쉘 기본값과 동일한 리전에서 생성되었다고 가정합니다.

Get-CTTrailStatus -Name myExampleTrail

예제 2: 현재 쉘 기본값이 아닌 리전(이 경우 프랑크푸르트(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 오류, 추적의 로깅 시작 및 중지 시간에 대한 정보가 포함됩니다. 이 예제에서는 추적이 현재 쉘 기본값과 동일한 리전에서 생성되었다고 가정합니다.

Get-CTTrailStatus -Name myExampleTrail

예제 2: 현재 쉘 기본값이 아닌 리전(이 경우 프랑크푸르트(eu-central-1) 리전)에서 생성된 추적의 상태 정보를 반환합니다.

Get-CTTrailStatus -Name myExampleTrail -Region eu-central-1
  • API 세부 정보는 AWS Tools for PowerShell Cmdlet 참조(V5)GetTrailStatus를 참조하세요.