使用 記錄 Amazon OpenSearch Ingestion API 呼叫 AWS CloudTrail - Amazon OpenSearch Service

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

使用 記錄 Amazon OpenSearch Ingestion API 呼叫 AWS CloudTrail

Amazon OpenSearch Ingestion 已與 服務整合 AWS CloudTrail,此服務可提供使用者、角色或 OpenSearch Ingestion 中 AWS 服務所採取之動作的記錄。

CloudTrail 會將 OpenSearch Ingestion 的所有 API 呼叫擷取為事件。擷取的呼叫包括來自 OpenSearch Service 主控台 OpenSearch Ingestion 區段的呼叫,以及對 OpenSearch Ingestion API 操作的程式碼呼叫。

如果您建立線索,則可以將 CloudTrail 事件持續交付至 Amazon S3 儲存貯體,包括 OpenSearch Ingestion 的事件。即使您未設定追蹤,依然可以透過 CloudTrail 主控台中的事件歷史記錄檢視最新事件。

您可以使用 CloudTrail 所收集的資訊,判斷對 OpenSearch Ingestion 提出的請求、提出請求的 IP 地址、提出請求的人員、提出請求的時間,以及其他詳細資訊。

若要進一步了解 CloudTrail,請參閱「AWS CloudTrail 使用者指南」

CloudTrail 中的 OpenSearch 擷取資訊

當您建立帳戶 AWS 帳戶 時,您的 上會啟用 CloudTrail。當活動在 OpenSearch Ingestion 中發生時,該活動會與事件歷史記錄中的其他 AWS 服務事件一起記錄在 CloudTrail 事件中。您可以檢視、搜尋和下載 AWS 帳戶的最新事件。如需詳細資訊,請參閱「使用 CloudTrail 事件歷史記錄檢視事件」

若要持續記錄 中的事件 AWS 帳戶,包括 OpenSearch Ingestion 的事件,請建立追蹤。線索能讓 CloudTrail 將日誌檔案交付至 Amazon S3 儲存貯體。依預設,當您在主控台中建立追蹤時,該追蹤會套用至所有的 AWS 區域。

線索會記錄 AWS 分割區中所有區域的事件,並將日誌檔案交付至您指定的 Amazon S3 儲存貯體。此外,您可以設定其他 AWS 服務,以進一步分析和處理 CloudTrail 日誌中所收集的事件資料。如需詳細資訊,請參閱下列內容:

CloudTrail 會記錄所有 OpenSearch Ingestion 動作,並記錄在 OpenSearch Ingestion API 參考中。例如,對 CreateCollectionListCollections 以及 DeleteCollection 動作發出的呼叫會在 CloudTrail 日誌檔案中產生項目。

每一筆事件或日誌專案都會包含產生請求者的資訊。身分資訊可協助您判斷:

  • 是否使用根或 AWS Identity and Access Management (IAM) 使用者登入資料提出請求。

  • 提出該請求時,是否使用了特定角色或聯合身分使用者的暫時安全憑證。

  • 請求是否由其他 AWS 服務提出。

如需詳細資訊,請參閱 CloudTrail userIdentity 元素

了解 OpenSearch Ingestion 日誌檔案項目

追蹤是一種組態,能讓事件以日誌檔案的形式交付到您指定的 Amazon S3 儲存貯體。CloudTrail 日誌檔案包含一個或多個日誌項目。

事件代表來自任何來源的單一請求。其中包含了請求的動作、動作的日期和時間、請求參數等相關資訊。CloudTrail 日誌檔並非依公有 API 呼叫的堆疊追蹤排序,因此不會以任何特定順序出現。

以下範例顯示的是展示 DeletePipeline 動作的 CloudTrail 日誌項目。

{ "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "AIDACKCEVSQ6C2EXAMPLE", "arn":"arn:aws:iam::123456789012:user/test-user", "accountId": "123456789012", "accessKeyId": "access-key", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "AIDACKCEVSQ6C2EXAMPLE", "arn": "arn:aws:iam::123456789012:role/Admin", "accountId": "123456789012", "userName": "Admin" }, "webIdFederationData": {}, "attributes": { "creationDate": "2023-04-21T16:48:33Z", "mfaAuthenticated": "false" } } }, "eventTime": "2023-04-21T16:49:22Z", "eventSource": "osis.amazonaws.com", "eventName": "UpdatePipeline", "awsRegion": "us-west-2", "sourceIPAddress": "123.456.789.012", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36", "requestParameters": { "pipelineName": "my-pipeline", "pipelineConfigurationBody": "version: \"2\"\nlog-pipeline:\n source:\n http:\n path: \"/test/logs\"\n processor:\n - grok:\n match:\n log: [ '%{COMMONAPACHELOG}' ]\n - date:\n from_time_received: true\n destination: \"@timestamp\"\n sink:\n - opensearch:\n hosts: [ \"https://search-b5zd22mwxhggheqpj5ftslgyle.us-west-2.es.amazonaws.com\" ]\n index: \"apache_logs2\"\n aws_sts_role_arn: \"arn:aws:iam::709387180454:role/canary-bootstrap-OsisRole-J1BARLD26QKN\"\n aws_region: \"us-west-2\"\n aws_sigv4: true\n" }, "responseElements": { "pipeline": { "pipelineName": "my-pipeline",sourceIPAddress "pipelineArn": "arn:aws:osis:us-west-2:123456789012:pipeline/my-pipeline", "minUnits": 1, "maxUnits": 1, "status": "UPDATING", "statusReason": { "description": "An update was triggered for the pipeline. It is still available to ingest data." }, "pipelineConfigurationBody": "version: \"2\"\nlog-pipeline:\n source:\n http:\n path: \"/test/logs\"\n processor:\n - grok:\n match:\n log: [ '%{COMMONAPACHELOG}' ]\n - date:\n from_time_received: true\n destination: \"@timestamp\"\n sink:\n - opensearch:\n hosts: [ \"https://search-b5zd22mwxhggheqpj5ftslgyle.us-west-2.es.amazonaws.com\" ]\n index: \"apache_logs2\"\n aws_sts_role_arn: \"arn:aws:iam::709387180454:role/canary-bootstrap-OsisRole-J1BARLD26QKN\"\n aws_region: \"us-west-2\"\n aws_sigv4: true\n", "createdAt": "Mar 29, 2023 1:03:44 PM", "lastUpdatedAt": "Apr 21, 2023 9:49:21 AM", "ingestEndpointUrls": [ "my-pipeline-tu33ldsgdltgv7x7tjqiudvf7m.us-west-2.osis.amazonaws.com" ] } }, "requestID": "12345678-1234-1234-1234-987654321098", "eventID": "12345678-1234-1234-1234-987654321098", "readOnly": false, "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "709387180454", "eventCategory": "Management", "tlsDetails": { "tlsVersion": "TLSv1.2", "cipherSuite": "ECDHE-RSA-AES128-GCM-SHA256", "clientProvidedHostHeader": "osis.us-west-2.amazonaws.com" }, "sessionCredentialFromConsole": "true" }