Object Storage - Server Access Logging
Objective
Server Access Logging provides detailed records for the requests that are made to a bucket. Server access logs are useful for many applications. For example, access log information can be useful in security and access audits.
This guide explains how to configure and use Server Access Logging.
Requirements
- A bucket
- A user with the required access rights on the bucket
- Have installed and configured aws-cli
See our Getting started with Object Storage guide.
Instruction
Create a bucket
Create a logs bucket
Your target bucket should not have Server Access Logging enabled. You can have logs delivered to any bucket that you own that is in the same Region as the source bucket, including the source bucket itself. However, this would cause an infinite loop of logs and is not recommended. For simpler log management, we recommend that you save access logs in a different bucket.
Configure bucket acl on logs bucket
Check the bucket acl configuration
Sample output :
Configure bucket logging parameters
Set the logging parameters for a bucket and specify permissions for who can view and modify the logging parameters.
logging.json
Check bucket logging parameters
Sample output :
View logs
After about one hour, the first logs are available:
Sample output :
Download a log:
Sample output :
Then read it:
Sample output :
The following list describes the log record fields:
- Bucket Owner: canonical user ID of the source bucket
- PROJECT_NAME:USER_NAME
- Bucket: bucket name
- Time: time at which the request was received
- format: [%d/%b/%Y:%H:%M:%S %z]
- Remote IP: apparent internet address of the requester
- Requester: canonical user ID of the requester
- PROJECT_NAME:USER_NAME
- Request ID: identify each request
- ex: txid0123456789abcdef
- Operation: operation listed here is declared
- SOAP.operation
- REST.HTTP_method.resource_type
- WEBSITE.HTTP_method.resource_type
- BATCH.DELETE.OBJECT
- S3.action.resource_type for Lifecycle and logging
- Key: object name
- Request-URI: Request-URI part of the HTTP request message
- HTTP status: numeric HTTP status code of the response
- Error Code: Amazon S3 Error code
- ex: NoSuchBucket
- Bytes Sent: number of response bytes sent
- Object Size: number of response bytes received?
- Total Time: number of milliseconds the request was in flight from the server's perspective
- Turn-Around Time: TTFB
- Referer: value of the HTTP Referer header
- User-Agent: value of the HTTP User-Agent header
- Version Id: object version ID
- Signature Version: signature version
- SigV2
- SigV4
- Authentication Type: type of request authentication used
- AuthHeader
- QueryString
- Host Header: endpoint used to connect to S3
- (BUCKET.)STORAGE_DOMAIN
Check log file acl
Sample output :
Disable Server Access Logging
Create an empty configuration file:
Then configure bucket logging parameters with this empty configuration file:
Go further
If you need training or technical assistance to implement our solutions, contact your sales representative or click on this link to get a quote and ask our Professional Services experts for assisting you on your specific use case of your project.
Join our community of users.