Flush Bucket Logging
--------------------
-Flushes all logging objects for a given source bucket (logging bucket are written lazily).
+Flushes logging object for a given source bucket (if not flushed, the logging objects are written lazily to the log bucket).
+Returns the name of the object that was flushed. An empty name will be returned if no object needs to be flushed.
Syntax
~~~~~~
POST /{bucket}?logging HTTP/1.1
+Response Entities
+~~~~~~~~~~~~~~~~~
+
+Response is XML encoded in the body of the request, in the following format:
+
+::
+
+ <PostBucketLoggingOutput xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
+ <FlushedLoggingObject>string</FlushedLoggingObject>
+ </PostBucketLoggingOutput>
HTTP Response
~~~~~~~~~~~~~
+---------------+-----------------------+----------------------------------------------------------+
| HTTP Status | Status Code | Description |
+===============+=======================+==========================================================+
-| ``201`` | Created | Flushed all logging objects successfully |
+| ``201`` | Created | Flushed pending logging object successfully |
+---------------+-----------------------+----------------------------------------------------------+
| ``404`` | NoSuchBucket | The bucket does not exist |
+---------------+-----------------------+----------------------------------------------------------+
"responseCode":201
},
"input":{"shape":"PostBucketLoggingRequest"},
+ "output": {"shape": "PostBucketLoggingOutput"},
"documentationUrl":"https://docs.ceph.com/docs/master/radosgw/s3/bucketops/#post-bucket-logging",
"documentation":"<p>Flushes the logging objects of the buckets.</p>"
},
}
}
},
+ "PostBucketLoggingOutput": {
+ "type":"structure",
+ "members":{
+ "FlushedLoggingObject": {
+ "shape":"FlushedLoggingObject",
+ "documentation":"<p>Name of the pending logging object that was flushed.</p>"
+ }
+ }
+ },
+ "FlushedLoggingObject":{
+ "type":"string"
+ },
"HeadBucketOutput":{
"type":"structure",
"members":{
rgw::bucketlogging::configuration configuration;
std::unique_ptr<rgw::sal::Bucket> target_bucket;
std::unique_ptr<rgw::sal::Bucket> source_bucket;
+ std::string old_obj;
int init_processing(optional_yield y) override {
if (const auto ret = verify_bucket_logging_params(this, s); ret < 0) {
ldpp_dout(this, 1) << "ERROR: failed to get pending logging object name from target bucket '" << target_bucket_id << "'" << dendl;
return;
}
- const auto old_obj = obj_name;
+ old_obj = obj_name;
const auto region = driver->get_zone()->get_zonegroup().get_api_name();
op_ret = rgw::bucketlogging::rollover_logging_object(configuration, target_bucket, obj_name, this, region, source_bucket, null_yield, true, &objv_tracker);
if (op_ret < 0) {
ldpp_dout(this, 20) << "INFO: flushed pending logging object '" << old_obj
<< "' to target bucket '" << target_bucket_id << "'" << dendl;
}
+
+ void send_response() override {
+ dump_errno(s);
+ end_header(s, this, to_mime_type(s->format));
+ dump_start(s);
+ s->formatter->open_object_section_in_ns("PostBucketLoggingOutput", XMLNS_AWS_S3);
+ s->formatter->dump_string("FlushedLoggingObject", old_obj);
+ s->formatter->close_section();
+ rgw_flush_formatter_and_reset(s, s->formatter);
+ }
};
RGWOp* RGWHandler_REST_BucketLogging_S3::create_post_op() {