跟踪是一种配置,可用于将事件作为日志文件传送到您指定的 S3 存储桶。CloudTrail 日志文件包含一个或多个日志条目。一个事件表示来自任何源的一个请求,包括有关请求的操作、操作的日期和时间、请求参数等方面的信息。CloudTrail 日志文件不是公用 API 调用的有序堆栈跟踪,因此它们不会按任何特定顺序显示。
注意
为了保护敏感信息,CodeBuild 日志中隐藏以下内容:
-
AWS 访问密钥 ID。有关更多信息,请参阅《AWS Identity and Access Management 用户指南》中的管理 IAM 用户的访问密钥。
-
使用参数存储指定的字符串。有关更多信息,请参阅《Amazon EC2 Systems Manager 用户指南》中的 Systems Manager Parameter Store 和 Systems Manager Parameter Store 控制台演练。
-
使用 AWS Secrets Manager 指定的字符串。有关更多信息,请参阅 密钥管理。
下面的示例显示了一个 CloudTrail 日志条目,该条目演示了如何在 CodeBuild 中创建构建项目。
{
"eventVersion": "1.05",
"userIdentity": {
"type": "FederatedUser",
"principalId": "account-ID
:user-name
",
"arn": "arn:aws:sts::account-ID
:federated-user/user-name
",
"accountId": "account-ID
",
"accessKeyId": "access-key-ID
",
"sessionContext": {
"attributes": {
"mfaAuthenticated": "false",
"creationDate": "2016-09-06T17:59:10Z"
},
"sessionIssuer": {
"type": "IAMUser",
"principalId": "access-key-ID
",
"arn": "arn:aws:iam::account-ID
:user/user-name
",
"accountId": "account-ID
",
"userName": "user-name
"
}
}
},
"eventTime": "2016-09-06T17:59:11Z",
"eventSource": "codebuild.amazonaws.com",
"eventName": "CreateProject",
"awsRegion": "region-ID
",
"sourceIPAddress": "127.0.0.1",
"userAgent": "user-agent
",
"requestParameters": {
"awsActId": "account-ID
"
},
"responseElements": {
"project": {
"environment": {
"image": "image-ID",
"computeType": "BUILD_GENERAL1_SMALL",
"type": "LINUX_CONTAINER",
"environmentVariables": []
},
"name": "codebuild-demo-project",
"description": "This is my demo project",
"arn": "arn:aws:codebuild:region-ID
:account-ID
:project/codebuild-demo-project:project-ID
",
"encryptionKey": "arn:aws:kms:region-ID
:key-ID
",
"timeoutInMinutes": 10,
"artifacts": {
"location": "arn:aws:s3:::codebuild-region-ID
-account-ID
-output-bucket",
"type": "S3",
"packaging": "ZIP",
"outputName": "MyOutputArtifact.zip"
},
"serviceRole": "arn:aws:iam::account-ID
:role/CodeBuildServiceRole",
"lastModified": "Sep 6, 2016 10:59:11 AM",
"source": {
"type": "GITHUB",
"location": "https://github.com/my-repo.git"
},
"created": "Sep 6, 2016 10:59:11 AM"
}
},
"requestID": "9d32b228-745b-11e6-98bb-23b67EXAMPLE",
"eventID": "581f7dd1-8d2e-40b0-aeee-0dbf7EXAMPLE",
"eventType": "AwsApiCall",
"recipientAccountId": "account-ID
"
}