doc-exports/docs/obs/s3api/en-us_topic_0125560463.html
Jawei, Li 1a4c1a720a OBS s3api 2.0.38.SP5
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: Jawei, Li <lijiawei5@huawei.com>
Co-committed-by: Jawei, Li <lijiawei5@huawei.com>
2022-11-16 14:51:13 +00:00

183 lines
13 KiB
HTML

<a name="EN-US_TOPIC_0125560463"></a><a name="EN-US_TOPIC_0125560463"></a>
<h1 class="topictitle1">GET Bucket logging</h1>
<div id="body15636382"><p class="msonormal" id="EN-US_TOPIC_0125560463__p4993867">You can use this operation to query the logging status of a bucket. This GET operation uses the <strong id="EN-US_TOPIC_0125560463__b6509718">logging</strong> subresource to return the logging status of a bucket.</p>
<p class="msonormal" id="EN-US_TOPIC_0125560463__p44944803">Only the bucket owner or users granted the <strong id="EN-US_TOPIC_0125560463__b594810111715">s3:GetBucketLogging</strong> permission can query the bucket logging status.</p>
<div class="section" id="EN-US_TOPIC_0125560463__section26394946"><h4 class="sectiontitle">Request Syntax</h4><pre class="screen" id="EN-US_TOPIC_0125560463__screen64525434113343">GET /?logging HTTP/1.1
User-Agent: agent
Host: bucketname.obs.example.com
Accept: */*
Date: date
Authorization: authorization</pre>
</div>
<div class="section" id="EN-US_TOPIC_0125560463__section36227930"><h4 class="sectiontitle">Request Parameters</h4><p id="EN-US_TOPIC_0125560463__p43058210">This request involves no parameters.</p>
</div>
<div class="section" id="EN-US_TOPIC_0125560463__section57615916"><h4 class="sectiontitle">Request Headers</h4><p id="EN-US_TOPIC_0125560463__p65163008">This request uses common headers. For details about common request headers, see section <a href="en-us_topic_0125560462.html">Common Request Headers</a>.</p>
</div>
<div class="section" id="EN-US_TOPIC_0125560463__section48781203"><h4 class="sectiontitle">Request Elements</h4><p id="EN-US_TOPIC_0125560463__p51032948">This request involves no elements.</p>
</div>
<div class="section" id="EN-US_TOPIC_0125560463__section7008729"><h4 class="sectiontitle">Response Syntax</h4><pre class="screen" id="EN-US_TOPIC_0125560463__screen2172668011348">HTTP/1.1 status_code
Server: Server Name
x-amz-request-id: request id
x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc
x-amz-id-2: id
Content-Type: type
Date: date
Content-Length:length
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;BucketLoggingStatus xmlns="http://obs.example.com/doc/2006-03-01/"&gt;
&lt;LoggingEnabled&gt;
&lt;TargetBucket&gt;bucketName&lt;/TargetBucket&gt;
&lt;TargetPrefix&gt;prefix&lt;/TargetPrefix&gt;
&lt;TargetGrants&gt;
&lt;Grant&gt;
&lt;Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser"&gt;
&lt;ID&gt;id&lt;/ID&gt;
&lt;DisplayName&gt;displayName&lt;/DisplayName&gt;
&lt;/Grantee&gt;
&lt;Permission&gt;permission&lt;/Permission&gt;
&lt;/Grant&gt;
&lt;/TargetGrants&gt;
&lt;/LoggingEnabled&gt;
&lt;/BucketLoggingStatus&gt;</pre>
</div>
<div class="section" id="EN-US_TOPIC_0125560463__section63078563"><h4 class="sectiontitle">Response Headers</h4><p id="EN-US_TOPIC_0125560463__p47532697">This response uses common headers. For details about common response headers, see section <a href="en-us_topic_0125560484.html">Common Response Headers</a>.</p>
</div>
<div class="section" id="EN-US_TOPIC_0125560463__section30836156"><h4 class="sectiontitle">Response Elements</h4><p id="EN-US_TOPIC_0125560463__p7136174">This response contains elements to specify the bucket logging status. <a href="#EN-US_TOPIC_0125560463__table56643352">Table 1</a> describes the elements.</p>
<div class="tablenoborder"><a name="EN-US_TOPIC_0125560463__table56643352"></a><a name="table56643352"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0125560463__table56643352" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Response elements</caption><thead align="left"><tr id="EN-US_TOPIC_0125560463__row24846201"><th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.9.3.2.4.1.1"><p id="EN-US_TOPIC_0125560463__p66385258">Element</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.9.3.2.4.1.2"><p id="EN-US_TOPIC_0125560463__p8496783">Description</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.9.3.2.4.1.3"><p id="EN-US_TOPIC_0125560463__p17150800">Remarks</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0125560463__row47037591"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.1 "><p id="EN-US_TOPIC_0125560463__p51948489">BucketLoggingStatus</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.2 "><p id="EN-US_TOPIC_0125560463__p47078096">Indicates the container for logging status information.</p>
<p id="EN-US_TOPIC_0125560463__p21049687">Type: Container</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.3 "><p id="EN-US_TOPIC_0125560463__p27303096">Mandatory</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0125560463__row44401276"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.1 "><p id="EN-US_TOPIC_0125560463__p39733617">LoggingEnabled</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.2 "><p id="EN-US_TOPIC_0125560463__p64306394">Indicates the container for logging information. This element is present when you are enabling logging (and not present when you are disabling logging).</p>
<p id="EN-US_TOPIC_0125560463__p41886638">Type: Container</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.3 "><p id="EN-US_TOPIC_0125560463__p37374497">Optional</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0125560463__row826154"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.1 "><p id="EN-US_TOPIC_0125560463__p66918496">Grant</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.2 "><p id="EN-US_TOPIC_0125560463__p51689132">Indicates the container for the grantee and the grantee's logging permission.</p>
<p id="EN-US_TOPIC_0125560463__p62549004">Type: Container</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.3 "><p id="EN-US_TOPIC_0125560463__p33304593">Optional</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0125560463__row31305887"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.1 "><p id="EN-US_TOPIC_0125560463__p52748952">Grantee</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.2 "><p id="EN-US_TOPIC_0125560463__p44806725">Indicates the container for users granted logging permission.</p>
<p id="EN-US_TOPIC_0125560463__p607347">Type: Container</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.3 "><p id="EN-US_TOPIC_0125560463__p49195146">Optional</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0125560463__row40103133"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.1 "><p id="EN-US_TOPIC_0125560463__p27128344">ID</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.2 "><p id="EN-US_TOPIC_0125560463__p49912231">DomainId of the grantee, Indicates the globally unique ID.</p>
<p id="EN-US_TOPIC_0125560463__p46556898">Type: String</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.3 "><p id="EN-US_TOPIC_0125560463__p13012363">Optional</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0125560463__row50002403"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.1 "><p id="EN-US_TOPIC_0125560463__p23662815">DisplayName</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.2 "><p id="EN-US_TOPIC_0125560463__p37639888">Indicates the name of the grantee. This element is not globally unique but a user ID corresponds to only one name.</p>
<p id="EN-US_TOPIC_0125560463__p3214680">Type: String</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.3 "><p id="EN-US_TOPIC_0125560463__p59062547">Optional</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0125560463__row61800880"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.1 "><p id="EN-US_TOPIC_0125560463__p39815407">Permission</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.2 "><p id="EN-US_TOPIC_0125560463__p3822530">Indicates the logging permission granted to the grantee for a bucket. The bucket owner is automatically granted the <strong id="EN-US_TOPIC_0125560463__b17279181819116">FULL_CONTROL</strong> permission when creating the bucket. Logging permission control access to different logs.</p>
<p id="EN-US_TOPIC_0125560463__p41189522">Type: String</p>
<p id="EN-US_TOPIC_0125560463__p35161380">Valid Values: FULL_CONTROL | READ | WRITE</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.3 "><p id="EN-US_TOPIC_0125560463__p29499513">Optional</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0125560463__row64169031"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.1 "><p id="EN-US_TOPIC_0125560463__p30308988">TargetBucket</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.2 "><p id="EN-US_TOPIC_0125560463__p39108941">Specifies the target bucket where bucket logs are stored. In OBS, logs of multiple buckets can be stored in the same target bucket. In this case, you need to use different <strong id="EN-US_TOPIC_0125560463__b16436156">TargetPrefix</strong> to distinguish the logs.</p>
<p id="EN-US_TOPIC_0125560463__p13707684">Type: String</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.3 "><p id="EN-US_TOPIC_0125560463__p36580582">Optional</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0125560463__row60789788"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.1 "><p id="EN-US_TOPIC_0125560463__p25025772">TargetPrefix</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.2 "><p id="EN-US_TOPIC_0125560463__p13821661">Specifies a prefix for keys of logs to be stored.</p>
<p id="EN-US_TOPIC_0125560463__p57286089">Type: String</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.3 "><p id="EN-US_TOPIC_0125560463__p9661646">Optional</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0125560463__row19845952"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.1 "><p id="EN-US_TOPIC_0125560463__p64018307">TargetGrants</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.2 "><p id="EN-US_TOPIC_0125560463__p18100358">Indicates the container for granting information.</p>
<p id="EN-US_TOPIC_0125560463__p28685495">Type: Container</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.3 "><p id="EN-US_TOPIC_0125560463__p41823741">Optional</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0125560463__section9089949"><h4 class="sectiontitle">Error Responses</h4><p id="EN-US_TOPIC_0125560463__p22083617">No special error responses are returned. For details about error responses, see <a href="en-us_topic_0125560440.html#EN-US_TOPIC_0125560440__table30733758">Table 1</a>.</p>
</div>
<div class="section" id="EN-US_TOPIC_0125560463__section4666767"><h4 class="sectiontitle">Sample Request</h4><pre class="screen" id="EN-US_TOPIC_0125560463__screen25422556113431">GET /?logging HTTP/1.1
User-Agent: curl/7.19.0
Host: bucketname.obs.example.com
Accept: */*
Date: Wed, 25 Nov 2009 12:00:00 GMT
Authorization: AWS UDSIAMSTUBTEST000002:IuWiXuyanEXDOKUMdUnyZ2J83sA=</pre>
</div>
<div class="section" id="EN-US_TOPIC_0125560463__section42000908"><h4 class="sectiontitle">Sample Response</h4><pre class="screen" id="EN-US_TOPIC_0125560463__screen16445258113445">HTTP/1.1 200 OK
Server: OBS
x-amz-request-id: 0000016594648286822DDF9487214C88
x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc
x-amz-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCSWVP7N5CZQGJzkZXBosuFJjC7XFsYQq
Date: Wed, 25 Nov 2009 12:00:00 GMT
Content_Length:277
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;BucketLoggingStatus xmlns="http://obs.example.com/doc/2006-03-01/"&gt;
&lt;LoggingEnabled&gt;
&lt;TargetBucket&gt;logging.bucket1&lt;/TargetBucket&gt;
&lt;TargetPrefix&gt;access_log&lt;/TargetPrefix&gt;
&lt;TargetGrants&gt;
&lt;Grant&gt;
&lt;Grantee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="CanonicalUser"&gt;
&lt;ID&gt;af258a3a0a1c2cd93011f75c1e031c043f47a25048490c8742f2f942464794e0&lt;/ID&gt;
&lt;DisplayName&gt;user&lt;/DisplayName&gt;
&lt;/Grantee&gt;
&lt;Permission&gt;FULL_CONTROL&lt;/Permission&gt;
&lt;/Grant&gt;
&lt;/TargetGrants&gt;
&lt;/LoggingEnabled&gt;
&lt;/BucketLoggingStatus&gt;</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="en-us_topic_0125560493.html">Operations on Buckets</a></div>
</div>
</div>