

# AWS CloudTrail 로그로 S3 on Outposts 모니터링
<a name="S3OutpostsCloudtrail"></a>

Amazon S3 on Outposts는 S3 on Outposts에서 사용자, 역할 또는 AWS 서비스가 수행한 작업에 대한 레코드를 제공하는 서비스인 AWS CloudTrail과 통합됩니다. AWS CloudTrail을 사용하여 S3 on Outposts 버킷 수준 및 객체 수준 요청에서 정보를 가져와서 S3 on Outposts 이벤트 활동을 감사하고 로깅할 수 있습니다.

모든 Outposts 버킷 또는 특정 Outposts 버킷 목록에 CloudTrail 데이터 이벤트를 활성화하려면 [CloudTrail에서 수동으로 추적을 생성](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-create-a-trail-using-the-console-first-time.html)해야 합니다. CloudTrail 로그 파일 항목에 대한 자세한 내용은 [S3 on Outposts 로그 파일 항목](https://docs.aws.amazon.com/AmazonS3/latest/userguide/cloudtrail-logging-understanding-s3-entries.html#cloudtrail-logging-understanding-s3outposts-entries)을 참조하세요.

S3 on Outposts의 CloudTrail 데이터 이벤트 전체 목록은 **Amazon S3 사용 설명서의 [CloudTrail의 Amazon S3 데이터 이벤트](https://docs.aws.amazon.com/AmazonS3/latest/userguide/cloudtrail-logging-s3-info.html#cloudtrail-data-events)를 참조하세요.

**참고**  
AWS CloudTrail 데이터 이벤트 Outposts 버킷에 대한 수명 주기 정책을 생성하는 것이 모범 사례입니다. 감사에 필요하다고 생각되는 기간이 지나면 로그 파일을 주기적으로 제거하도록 수명 주기 정책을 구성합니다. 그러면 Amazon Athena에서 쿼리마다 분석하는 데이터의 양이 줄어듭니다. 자세한 내용은 [Amazon S3 on Outposts 버킷에 대한 수명 주기 구성 생성 및 관리](S3OutpostsLifecycleManaging.md) 섹션을 참조하세요.
CloudTrail 로그를 쿼리하는 방법의 예제는 *AWS 빅 데이터 블로그* [AWS CloudTrail 및 Amazon Athena를 사용하여 보안, 규정 준수 및 운영 활동 분석](https://aws.amazon.com/blogs/big-data/aws-cloudtrail-and-amazon-athena-dive-deep-to-analyze-security-compliance-and-operational-activity/)을 참조하십시오.

## S3 on Outposts 버킷의 객체에 대해 CloudTrail 로깅 활성화
<a name="s3-outposts-add-bucket-events-cloudtrail"></a>

Amazon S3 콘솔에서 AWS CloudTrail 추적을 구성하여 Amazon S3 on Outposts 버킷의 객체에 대한 데이터 이벤트를 로깅할 수 있습니다. CloudTrail은 `GetObject`, `DeleteObject`, `PutObject` 같은 S3 on Outposts 객체 수준 API 작업 로깅을 지원합니다. 이 이벤트를 *데이터 이벤트*라고 합니다.

기본적으로 CloudTrail 추적은 데이터 이벤트를 로깅하지 않습니다. 그러나 지정한 S3 on Outposts 버킷에 대해 데이터 이벤트를 로깅하거나 AWS 계정에 있는 모든 S3 on Outposts 버킷에 대해 데이터 이벤트를 로깅하도록 추적을 구성할 수 있습니다.

CloudTrail은 CloudTrail 이벤트 기록의 데이터 이벤트를 채우지 않습니다. 또한 모든 S3 on Outposts 버킷 수준 API 작업이 CloudTrail 이벤트 기록에 채워지는 것은 아닙니다. CloudTrail 로그를 쿼리하는 방법에 대한 자세한 내용은 AWS 지식 센터에서 [Amazon CloudWatch Logs 필터 패턴 및 Amazon Athena를 사용하여 CloudTrail 로그 쿼리](https://aws.amazon.com/premiumsupport/knowledge-center/find-cloudtrail-object-level-events/)를 참조하세요.

S3 on Outposts 버킷에 대한 데이터 이벤트를 로깅하도록 추적을 구성하기 위해 AWS CloudTrail 콘솔 또는 Amazon S3 콘솔을 사용할 수 있습니다. AWS 계정의 모든 S3 on Outposts 버킷에 대해 데이터 이벤트를 로깅하도록 추적을 구성하는 경우 CloudTrail 콘솔을 사용하는 것이 더 편리합니다. CloudTrail 콘솔을 사용하여 S3 on Outposts 데이터 이벤트를 로깅하도록 추적을 구성하는 방법에 대한 자세한 내용은 AWS CloudTrail 사용 설명서**에서 [데이터 이벤트](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html#logging-data-events)를 참조하세요.

**중요**  
데이터 이벤트에는 추가 요금이 적용됩니다. 자세한 내용은 [AWS CloudTrail 요금](https://aws.amazon.com/cloudtrail/pricing/)을 참조하십시오.

다음 절차는 Amazon S3 콘솔을 사용하여 CloudTrail 추적이 S3 on Outposts 버킷에 대한 데이터 이벤트를 로깅할 수 있도록 구성하는 방법을 보여줍니다.

**참고**  
버킷을 생성하는 AWS 계정이 버킷을 소유하며 이 계정은 AWS CloudTrail로 전송할 S3 on Outposts 데이터 이벤트를 구성할 수 있는 유일한 계정입니다.

**S3 on Outposts 버킷의 객체에 대해 CloudTrail 데이터 이벤트 로깅 활성화**

1. AWS Management Console에 로그인한 후 [https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/)에서 S3 콘솔을 엽니다.

1. 왼쪽 탐색 창에서 **Outposts 버킷**을 선택합니다.

1. CloudTrail을 사용하여 로깅하려는 데이터 이벤트가 있는 Outposts 버킷의 이름을 선택합니다.

1. **속성**을 선택합니다.

1. **AWS CloudTrail 데이터 이벤트** 섹션으로 이동하고 **CloudTrail에서 구성**을 선택합니다.

   AWS CloudTrail 콘솔이 열립니다.

   새 CloudTrail 추적을 생성하거나 기존 추적을 재사용하고 추적에 로깅되도록 S3 on Outposts 데이터 이벤트를 구성할 수 있습니다.

1. CloudTrail 콘솔 **대시보드** 페이지에서 **추적 생성**을 선택합니다.

1. **1단계 추적 속성 선택** 페이지에서 추적의 이름을 제공하고 추적 로그를 저장할 S3 버킷을 선택하고 원하는 기타 설정을 지정한 후, **다음**을 선택합니다.

1. **2단계 로그 이벤트 선택** 페이지의 **이벤트 유형**에서 **데이터 이벤트**를 선택합니다.

   **데이터 이벤트 유형**에서 **S3 Outposts**를 선택합니다. **다음**을 선택합니다.
**참고**  
추적을 생성하고 S3 on Outposts에 대한 데이터 이벤트 로깅을 구성할 때 데이터 이벤트 유형을 올바르게 지정해야 합니다.  
CloudTrail 콘솔을 사용하는 경우 **데이터 이벤트 유형**으로 **S3 Outposts**를 선택하세요. CloudTrail 콘솔에서 추적을 생성하는 자세한 방법은 *AWS CloudTrail 사용 설명서*에서 [콘솔을 사용하여 추적 생성 및 업데이트](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html#logging-data-events)를 참조하십시오. CloudTrail 콘솔을 사용하여 S3 on Outposts 데이터 이벤트 로깅을 구성하는 방법에 대한 자세한 내용은 AWS CloudTrail 사용 설명서**에서 [Amazon S3 객체의 데이터 이벤트 로깅](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html#logging-data-events-examples)을 참조하세요.
AWS Command Line Interface(AWS CLI) 또는 AWS SDK를 사용하는 경우 `resources.type` 필드를 `AWS::S3Outposts::Object`로 설정합니다. AWS CLI를 사용하여 S3 on Outposts 데이터 이벤트를 로깅하는 방법에 대한 자세한 내용은 **AWS CloudTrail 사용 설명서의 [S3 on Outposts 이벤트 로깅](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html#creating-data-event-selectors-CLI-outposts)을 참조하세요.
CloudTrail 콘솔이나 Amazon S3 콘솔을 사용하여 S3 on Outposts 버킷에 대해 데이터 이벤트를 로깅하도록 추적을 구성하면 Amazon S3 콘솔에는 해당 버킷에 대해 객체 수준 로깅이 활성화된 것으로 표시됩니다.

1. **3단계 검토 및 생성** 페이지에서 구성한 추적 속성과 로그 이벤트를 검토합니다. **추적 생성**을 선택합니다.

**S3 on Outposts 버킷의 객체에 대해 CloudTrail 데이터 이벤트 로깅 비활성화**

1. AWS Management Console에 로그인하여 [https://console.aws.amazon.com/cloudtrail/](https://console.aws.amazon.com/cloudtrail/)에서 CloudTrail 콘솔을 엽니다.

1. 왼쪽 탐색 창에서 **추적**을 선택합니다.

1. S3 on Outposts 버킷에 이벤트를 로깅하기 위해 생성한 추적의 이름을 선택합니다.

1. 추적의 세부 정보 페이지에서 오른쪽 상단의 **로깅 중지**를 선택합니다.

1. 표시되는 대화 상자에서 **로깅 중지**를 선택합니다.

## Amazon S3 on Outposts AWS CloudTrail 로그 파일 항목
<a name="s3-outposts-cloudtrail-logs"></a>

Amazon S3 on Outposts 관리 이벤트는 AWS CloudTrail을 통해 사용할 수 있습니다. 필요하면 [AWS CloudTrail에서 데이터 이벤트에 대한 로깅을 사용](https://docs.aws.amazon.com/AmazonS3/latest/user-guide/enable-cloudtrail-events.html)할 수도 있습니다.

 *추적*이란 지정한 리전의 S3 버킷에 이벤트를 로그 파일로 입력할 수 있도록 하는 구성입니다. Outposts 버킷에 대한 CloudTrail 로그에는 지정된 버킷이 있는 Outpost를 식별하는 `edgeDeviceDetails`라는 새 필드가 포함됩니다.

추가 로그 필드에는 요청된 작업, 작업 날짜 및 시간과 요청 파라미터가 포함됩니다. CloudTrail 로그 파일은 퍼블릭 API 호출에 대한 순서 지정된 스택 추적이 아니기 때문에 특정 순서로 표시되지 않습니다.

다음 예제에서는 `s3-outposts`의 [PutObject](https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html) 작업을 보여주는 CloudTrail 로그 항목을 확인할 수 있습니다.

```
{
      "eventVersion": "1.08",
      "userIdentity": {
        "type": "IAMUser",
        "principalId": "111122223333",
        "arn": "arn:aws:iam::111122223333:user/yourUserName",
        "accountId": "222222222222",
        "accessKeyId": "AKIAIOSFODNN7EXAMPLE",
        "userName": "yourUserName"
      },
      "eventTime": "2020-11-30T15:44:33Z",
      "eventSource": "s3-outposts.amazonaws.com",
      "eventName": "PutObject",
      "awsRegion": "us-east-1",
      "sourceIPAddress": "26.29.66.20",
      "userAgent": "aws-cli/1.18.39 Python/3.4.10 Darwin/18.7.0 botocore/1.15.39",
      "requestParameters": {
        "expires": "Wed, 21 Oct 2020 07:28:00 GMT",
        "Content-Language": "english",
        "x-amz-server-side-encryption-customer-key-MD5": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
        "ObjectCannedACL": "BucketOwnerFullControl",
        "x-amz-server-side-encryption": "Aes256",
        "Content-Encoding": "gzip",
        "Content-Length": "10",
        "Cache-Control": "no-cache",
        "Content-Type": "text/html; charset=UTF-8",
        "Content-Disposition": "attachment",
        "Content-MD5": "je7MtGbClwBF/2Zp9Utk/h3yCo8nvbEXAMPLEKEY",
        "x-amz-storage-class": "Outposts",
        "x-amz-server-side-encryption-customer-algorithm": "Aes256",
        "bucketName": "amzn-s3-demo-bucket1",
        "Key": "path/upload.sh"
      },
      "responseElements": {
        "x-amz-server-side-encryption-customer-key-MD5": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
        "x-amz-server-side-encryption": "Aes256",
        "x-amz-version-id": "001",
        "x-amz-server-side-encryption-customer-algorithm": "Aes256",
        "ETag": "d41d8cd98f00b204e9800998ecf8427f"
      },
      "additionalEventData": {
        "CipherSuite": "ECDHE-RSA-AES128-SHA",
        "bytesTransferredIn": 10,
        "x-amz-id-2": "29xXQBV2O+xOHKItvzY1suLv1i6A52E0zOX159fpfsItYd58JhXwKxXAXI4IQkp6",
        "SignatureVersion": "SigV4",
        "bytesTransferredOut": 20,
        "AuthenticationMethod": "AuthHeader"
      },
      "requestID": "8E96D972160306FA",
      "eventID": "ee3b4e0c-ab12-459b-9998-0a5a6f2e4015",
      "readOnly": false,
      "resources": [
        {
          "accountId": "222222222222",
          "type": "AWS::S3Outposts::Object",
          "ARN": "arn:aws:s3-outposts:us-east-1:YYY:outpost/op-01ac5d28a6a232904/bucket/path/upload.sh"
        },
        {
          "accountId": "222222222222",
          "type": "AWS::S3Outposts::Bucket",
          "ARN": "arn:aws:s3-outposts:us-east-1:YYY:outpost/op-01ac5d28a6a232904/bucket/"
        }
      ],
      "eventType": "AwsApiCall",
      "managementEvent": false,
      "recipientAccountId": "444455556666",
      "sharedEventID": "02759a4c-c040-4758-b84b-7cbaaf17747a",
      "edgeDeviceDetails": {
        "type": "outposts",
        "deviceId": "op-01ac5d28a6a232904"
      },
      "eventCategory": "Data"
    }
```