LogFormat
Amazon S3 Server Access Log Format
This section describes the Amazon S3 server access log files.
Topics
- Additional Logging for Copy Operations
- Custom Access Log Information
- Programming Considerations for Extensible Server Access Log Format
The server access log files consist of a sequence of newline-delimited log records. Each log record represents one request and consists of space-delimited fields. The following is an example log consisting of five log records.
Note
Any field can be set to -
to indicate that the data was unknown or unavailable, or that the field was not applicable to this request.
The following list describes the log record fields.
Bucket Owner
The canonical user ID of the owner of the source bucket. The canonical user ID is another form of the AWS account ID. For more information about the canonical user ID, see AWS Account Identifiers. For information about how to find the canonical user ID for your account, see Finding Your Account Canonical User ID.
Example Entry
Bucket
The name of the bucket that the request was processed against. If the system receives a malformed request and cannot determine the bucket, the request will not appear in any server access log.
Example Entry
Time
The time at which the request was received; these dates and times are in Coordinated Universal time (UTC). The format, using strftime()
terminology, is as follows: [%d/%b/%Y:%H:%M:%S %z]
Example Entry
Remote IP
The apparent internet address of the requester. Intermediate proxies and firewalls might obscure the actual address of the machine making the request.
Example Entry
Requester
The canonical user ID of the requester, or a -
for unauthenticated requests. If the requester was an IAM user, this field returns the requester's IAM user name along with the AWS root account that the IAM user belongs to. This identifier is the same one used for access control purposes.
Example Entry
Request ID
A string generated by Amazon S3 to uniquely identify each request.
Example Entry
Operation
The operation listed here is declared as SOAP.operation
, REST.HTTP_method.resource_type
, WEBSITE.HTTP_method.resource_type
, or BATCH.DELETE.OBJECT
.
Example Entry
Key
The "key" part of the request, URL encoded, or "-" if the operation does not take a key parameter.
Example Entry
Request-URI
The Request-URI part of the HTTP request message.
Example Entry
HTTP status
The numeric HTTP status code of the response.
Example Entry
Error Code
The Amazon S3 Error Code, or "-" if no error occurred.
Example Entry
Bytes Sent
The number of response bytes sent, excluding HTTP protocol overhead, or "-" if zero.
Example Entry
Object Size
The total size of the object in question.
Example Entry
Total Time
The number of milliseconds the request was in flight from the server's perspective. This value is measured from the time your request is received to the time that the last byte of the response is sent. Measurements made from the client's perspective might be longer due to network latency.
Example Entry
Turn-Around Time
The number of milliseconds that Amazon S3 spent processing your request. This value is measured from the time the last byte of your request was received until the time the first byte of the response was sent.
Example Entry
Referer
The value of the HTTP Referer header, if present. HTTP user-agents (for example, browsers) typically set this header to the URL of the linking or embedding page when making a request.
Example Entry
User-Agent
The value of the HTTP User-Agent header.
Example Entry
Version Id
The version ID in the request, or "-" if the operation does not take a versionId
parameter.
Example Entry
Host Id
The x-amz-id-2 or Amazon S3 extended request ID.
Example Entry
Signature Version
The signature version, SigV2
or SigV4
, that was used to authenticate the request or a -
for unauthenticated requests.
Example Entry
Cipher Suite
The Secure Sockets Layer (SSL) cipher that was negotiated for HTTPS request or a -
for HTTP.
Example Entry
Authentication Type
The type of request authentication used, AuthHeader
for authentication headers, QueryString
for query string (pre-signed URL) or a -
for unauthenticated requests.
Example Entry
Host Header
The endpoint used to connect to Amazon S3
Example Entry
Some older Regions support legacy endpoints. You may see these endpoints in your server access logs or CloudTrail logs. For more information, see Legacy Endpoints. For a complete list of Amazon S3 Regions and endpoints, see Amazon S3 Regions and Endpoints in the AWS General Reference.
TLS version
The Transport Layer Security (TLS) version negotiated by the client. The value is one of following: TLSv1
, TLSv1.1
, TLSv1.2
; or -
if TLS wasn't used.
Example Entry
Additional Logging for Copy Operations
A copy operation involves a GET
and a PUT
. For that reason, we log two records when performing a copy operation. The previous table describes the fields related to the PUT
part of the operation. The following list describes the fields in the record that relate to the GET
part of the copy operation.
Bucket Owner
The canonical user ID of the bucket that stores the object being copied. The canonical user ID is another form of the AWS account ID. For more information about the canonical user ID, see AWS Account Identifiers. For information about how to find the canonical user ID for your account, see Finding Your Account Canonical User ID.
Example Entry
Bucket
The name of the bucket that stores the object being copied.
Example Entry
Time
The time at which the request was received; these dates and times are in Coordinated Universal time (UTC). The format, using strftime()
terminology, is as follows: [%d/%B/%Y:%H:%M:%S %z]
Example Entry
Remote IP
The apparent internet address of the requester. Intermediate proxies and firewalls might obscure the actual address of the machine making the request.
Example Entry
Requester
The canonical user ID of the requester, or a -
for unauthenticated requests. If the requester was an IAM user, this field will return the requester's IAM user name along with the AWS root account that the IAM user belongs to. This identifier is the same one used for access control purposes.
Example Entry
Request ID
A string generated by Amazon S3 to uniquely identify each request.
Example Entry
Operation
The operation listed here is declared as SOAP.operation
, REST.HTTP_method.resource_type
, WEBSITE.HTTP_method.resource_type
, or BATCH.DELETE.OBJECT
.
Example Entry
Key
The "key" of the object being copied or "-" if the operation does not take a key parameter.
Example Entry
Request-URI
The Request-URI part of the HTTP request message.
Example Entry
HTTP status
The numeric HTTP status code of the GET
portion of the copy operation.
Example Entry
Error Code
The Amazon S3 Error Code, of the GET
portion of the copy operation or "-" if no error occurred.
Example Entry
Bytes Sent
The number of response bytes sent, excluding HTTP protocol overhead, or "-" if zero.
Example Entry
Object Size
The total size of the object in question.
Example Entry
Total Time
The number of milliseconds the request was in flight from the server's perspective. This value is measured from the time your request is received to the time that the last byte of the response is sent. Measurements made from the client's perspective might be longer due to network latency.
Example Entry
Turn-Around Time
The number of milliseconds that Amazon S3 spent processing your request. This value is measured from the time the last byte of your request was received until the time the first byte of the response was sent.
Example Entry
Referer
The value of the HTTP Referer header, if present. HTTP user-agents (for example, browsers) typically set this header to the URL of the linking or embedding page when making a request.
Example Entry
User-Agent
The value of the HTTP User-Agent header.
Example Entry
Version Id
The version ID of the object being copied or "-" if the x-amz-copy-source
header didn’t specify a versionId
parameter as part of the copy source.
Example Entry
Host Id
The x-amz-id-2 or Amazon S3 extended request ID.
Example Entry
Signature Version
The signature version, SigV2
or SigV4
, that was used to authenticate the request or a -
for unauthenticated requests.
Example Entry
Cipher Suite
The Secure Sockets Layer (SSL) cipher that was negotiated for HTTPS request or a -
for HTTP.
Example Entry
Authentication Type
The type of request authentication used, AuthHeader
for authentication headers, QueryString
for query string (pre-signed URL) or a -
for unauthenticated requests.
Example Entry
Host Header
The endpoint used to connect to Amazon S3.
Example Entry
Some older Regions support legacy endpoints. You may see these endpoints in your server access logs or CloudTrail logs. For more information, see Legacy Endpoints. For a complete list of Amazon S3 Regions and endpoints, see Amazon S3 Regions and Endpoints in the AWS General Reference.
TLS version
The Transport Layer Security (TLS) version negotiated by the client. The value is one of following: TLSv1
, TLSv1.1
, TLSv1.2
; or -
if TLS wasn't used.
Example Entry
Custom Access Log Information
You can include custom information to be stored in the access log record for a request by adding a custom query-string parameter to the URL for the request. Amazon S3 ignores query-string parameters that begin with "x-", but includes those parameters in the access log record for the request, as part of the Request-URI
field of the log record. For example, a GET
request for "s3.amazonaws.com/awsexamplebucket/photos/2019/08/puppy.jpg?x-user=johndoe" works the same as the same request for "s3.amazonaws.com/awsexamplebucket/photos/2019/08/puppy.jpg", except that the "x-user=johndoe" string is included in the Request-URI
field for the associated log record. This functionality is available in the REST interface only.
Programming Considerations for Extensible Server Access Log Format
From time to time, we might extend the access log record format by adding new fields to the end of each line. Code that parses server access logs must be written to handle trailing fields that it does not understand.