• Object Storage Service

obs
  1. Help Center
  2. Object Storage Service
  3. API Reference (OBS)
  4. Operations on Buckets
  5. PUT Bucket logging
  6. Examples

Examples

Sample Requests

Configure the ACL for the target bucket to which logs are delivered

PUT /?acl HTTP/1.1
User-Agent: Jakarta Commons-HttpClient/3.1
Host: bucketname.obs.example.com
Accept-Encoding: gzip,deflate
Date: Mon, 27 Sep 2010 01:37:17 GMT
Authorization: AWS 04RZT432N80TGDF2Y2G2:9uNLINAQ7IOIrD9OnCpDfY2R6nU=
Content-Length: 598
 
<AccessControlPolicy xmlns="http://obs.example.com/doc/2006-03-01/">
<Owner>
<ID>0022A1B8CD8B00000145870549B10002</ID>
<DisplayName>huangjiang112</DisplayName>
</Owner>
<AccessControlList>
<Grant>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser">
<ID>0022A1B8CD8B00000145870549B10002</ID>
<DisplayName>user</DisplayName>
</Grantee>
<Permission>FULL_CONTROL</Permission>
</Grant>
<Grant>
<Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Group">
<URI>http://acs.amazonaws.com/groups/s3/LogDelivery</URI>
</Grantee>
<Permission>FULL_CONTROL</Permission>
</Grant>
</AccessControlList>
</AccessControlPolicy>

Configure logging for the source bucket

PUT /?logging HTTP/1.1 
 User-Agent: curl/7.19.0
 Host: bucketname.obs.example.com
 Accept: */*
 Date: date 
 Authorization: signatureValue
 Content-Length: 649 

 <?xml version="1.0" encoding="UTF-8"?> 
 <BucketLoggingStatus xmlns="http://obs.example.com/doc/2006-03-01/">
 <LoggingEnabled> 
 <TargetBucket>logging.bucket1</TargetBucket> 
 <TargetPrefix>access_log</TargetPrefix> 
 <TargetGrants> 
 <Grant> 
 <Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser"> 
 <ID>af258a3a0a1c2cd93011f75c1e031c043f47a25048490c8742f2f942464794e0</ID> 
 <DisplayName>user</DisplayName> 
 </Grantee> 
 <Permission>FULL_CONTROL</Permission> 
 </Grant> 
 </TargetGrants> 
 </LoggingEnabled> 
 </BucketLoggingStatus>

Sample Responses

Set Acl Response

HTTP/1.1 200 OK
x-amz-request-id: 7B6DFC9BC71DD58B061285551605709
x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc
x-amz-id-2: N0I2REZDOUJDNzFERDU4QjA2MTI4NTU1MTYwNTcwOUFBQUFBQUFBYmJiYmJiYmJD
Content-Type: text/xml
Date: Mon, 27 Sep 2010 01:40:03 GMT
Content-Length: 0

Put Logging Response

HTTP/1.1 200 OK 
 Server: OBS 
 x-amz-request-id: 7B6DFC9BC71DD58B061285551605709 
 x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc 
 x-amz-id-2: N0I2REZDOUJDNzFERDU4QjA2MTI4NTU1MTYwNTcwOUFBQUFBQUFBYmJiYmJiYmJD 
 Date: Mon, 27 Sep 2010 01:40:03 GMT 
 Content-Length: 0