logging-with-S3

Logging with Amazon S3

You can record the actions that are taken by users, roles, or AWS services on Amazon S3 resources and maintain log records for auditing and compliance purposes. To do this, you can use Amazon S3 Server Access Logging, AWS CloudTrail logs, or a combination of both. We recommend that you use AWS CloudTrail for logging bucket and object-level actions for your Amazon S3 resources.

The following table lists the key properties of AWS CloudTrail logs and Amazon S3 server access logs.

Log PropertiesAWS CloudTrailAmazon S3 Server Logs
Can be forwarded to other systems (CloudWatch Logs, CloudWatch Events)Yes
Deliver logs to more than one destination (for example, send the same logs to two different buckets)Yes
Turn on logs for a subset of objects (prefix)Yes
Cross-account log delivery (target and source bucket owned by different accounts)Yes
Integrity validation of log file using digital signature/hashingYes
Default/choice of encryption for log filesYes
Object operations (using Amazon S3 APIs)YesYes
Bucket operations (using Amazon S3 APIs)YesYes
Searchable UI for logsYes
Fields for object lock parameters, Amazon S3 select properties for log recordsYes
Fields for Object Size, Total Time, Turn-Around Time, and HTTP Referer for log recordsYes
Lifecycle transitions, expirations, restoresYes
Logging of keys in a batch delete operationYes
Authentication failures1Yes
Accounts where logs get deliveredBucket owner2, and requesterBucket owner only
Performance and CostAWS CloudTrailAmazon S3 Server Logs
PriceManagement events (first delivery) are free; data events incur a fee, in addition to storage of logsNo additional cost in addition to storage of logs
Speed of log deliveryData events every 5 mins; management events every 15 minsWithin a few hours
Log formatJSONLog file with space-separated, newline-delimited records

Notes:

  1. CloudTrail does not deliver logs for requests that fail authentication (in which the provided credentials are not valid). However, it does include logs for requests in which authorization fails (AccessDenied) and requests that are made by anonymous users.

  2. The S3 bucket owner receives CloudTrail logs only if the account also owns or has full access to the object in the request. For more information, see Object-Level Actions in Cross-Account Scenarios.