本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
使用记录 Amazon OpenSearch Ingestion API 调用 Amazon CloudTrail
Amazon OpenSearch Ingestion 与集成 Amazon CloudTrail,后者是在 Ingestion 中提供用户、角色或服务所采取操作的记录的 Amazon OpenSearch 服务。
CloudTrail 将针对 OpenSearch Ingestion 的所有 API 调用作为事件捕获。捕获的调用包括来自 OpenSearch 服务控制台 OpenSearch Ingestion 部分的调用,以及针对 In OpenSearch gestion API 操作的代码调用。
如果您创建跟踪,则可以使 CloudTrail 事件持续传送到 Amazon S3 存储桶(包括 OpenSearch Ingestion 的事件)。如果您不配置跟踪,则仍可在 CloudTrail 控制台的 Event history (事件历史记录) 中查看最新事件。
通过使用收集的信息 CloudTrail,您可以确定向 OpenSearch Ingestion 发出了什么请求、发出请求的 IP 地址、何人发出的请求、请求的发出时间,以及其他详细信息。
要了解更多信息 CloudTrail,请参阅Amazon CloudTrail 用户指南。
OpenSearch 中的摄取信息 CloudTrail
CloudTrail 在您创建账户 Amazon Web Services 账户 时已在您的账户上启用。当 OpenSearch Ingestion 中发生活动时,该活动将记录在事件中,并与其他 Amazon 服务 CloudTrail 事件一同保存在 Event histion 中。您可以在 Amazon Web Services 账户中查看、搜索和下载最新事件。有关更多信息,请参阅使用事件历史记录查看 CloudTrail 事件。
要持续记录中的事件(包括 OpenSearch Ingestion 的事件),请 Amazon Web Services 账户创建跟踪。通过跟踪 CloudTrail ,您可以将日志文件传送至 Amazon S3 存储桶。预设情况下,在控制台中创建跟踪记录时,此跟踪记录应用于所有 Amazon Web Services 区域。
此跟踪记录来自 Amazon 分区中的所有区域的事件,并将日志文件传送至您指定的 Amazon S3 存储桶。此外,您可以配置其他 Amazon 服务,进一步分析在 CloudTrail 日志中收集的事件数据并采取操作。有关更多信息,请参阅下列内容:
所有 OpenSearch 摄取操作均由 In OpenSearch g estion CloudTrail API 参考记录并记录在内。例如,对 CreateCollection
、ListCollections
和 DeleteCollection
操作的调用会在 CloudTrail 日志文件中生成条目。
每个事件或日志条目都包含有关生成请求的人员信息。身份信息可以帮助您确定:
-
请求是使用根用户凭证还是 Amazon Identity and Access Management (IAM) 用户凭证发出的。
-
请求是使用角色还是联合用户的临时安全凭证发出的。
-
请求是否由其他 Amazon 服务发出。
有关更多信息,请参阅 CloudTrail userIdentity 元素。
了解 OpenSearch 摄取日志文件条目
跟踪是一种配置,可用于将事件作为日志文件传送到您指定的 Amazon S3 存储桶。 CloudTrail 日志文件包含一个或多个日志条目。
事件表示来自任何源的单个请求。它包括有关所请求操作的信息、操作的日期和时间、请求参数等。 CloudTrail 日志文件不是公用 API 调用的有序堆栈跟踪,因此它们不会按任何特定顺序显示。
下面的示例显示了一个 CloudTrail 日志条目,该条目说明了DeletePipeline
操作。
{ "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" }