Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
38a5150
rgw: bl impl track progress and rgw-admin support
Apr 1, 2017
920a9a6
rgw: bl impl ceph-dencoder dump bl pool config
Apr 11, 2017
fd6d984
rgw: bl impl GetBL/PutBL s3 api
Mar 20, 2017
5180ec9
rgw: bl impl disable bl via PutBL s3 api
Mar 22, 2017
b9600a7
rgw: bl impl filter opslog obj list by bucket
Mar 23, 2017
a01a8aa
rgw: bl impl bl deliver user CLI API
Apr 11, 2017
b98b57c
rgw: bl only allow bl_deliver user to PutObj
Apr 24, 2017
4725d46
rgw: bl ban bl_deliver user for bucket creation
Apr 24, 2017
746e5de
rgw: bl impl dump bl_deliver flag when dump user info
Apr 11, 2017
b5893bc
rgw: bl impl create/modify bl_deliver user via HTTP API
Apr 11, 2017
166eec8
rgw: bl impl opslog entry formatting
Mar 31, 2017
2c1b4ca
rgw: bl impl upload opslog
Apr 9, 2017
cf98ef1
rgw: bl doc rgw bucket logging config procedure
ZVampirEM77 Apr 12, 2017
90c86bc
rgw: bl fix bl_fetch seg fault
Apr 17, 2017
b14e657
rgw: bl add debug info
Apr 17, 2017
f2f370d
rgw: bl fix random string size to 16
Apr 17, 2017
c6896d2
rgw: bl fix rgw-admin log show filter by bucket
Apr 18, 2017
4400f3b
rgw: bl fix log file render issue
Apr 18, 2017
a9c5ac1
rgw: bl cleanup debug log
Apr 18, 2017
1214ad9
rgw: bl fix list erro when all obj shards aren't created
Apr 21, 2017
c2ea57e
rgw: bl expose PERM_ERROR status reflect auth issue
Apr 18, 2017
bdcd4ad
rgw: bl add debug log
Apr 19, 2017
b7f30fe
rgw: bl target object user target bucket ACL
Apr 28, 2017
220d52f
rgw: bl add rgw_bl_debug_interval option
Apr 20, 2017
66937b0
rgw: bl cleanup homebrewed split with boost::split
Apr 20, 2017
f5c7b51
rgw: bl make GetBL response s3cmd compatibile
Apr 24, 2017
1a635d6
rgw: bl cleanup bl entry when bl status is disabled
Apr 26, 2017
c526cf6
rgw: bl improve PutBL s3 parser compatible
Apr 26, 2017
b3f8158
rgw: bl PutBL check tbucker ownership
Apr 26, 2017
ecfae32
rgw: bl fix bl_process didn't process all bl.X
Apr 27, 2017
4348228
rgw: bl deliver all via single bl process
Apr 28, 2017
e9d92d2
rgw: doc s3 bucket logging support status
Apr 28, 2017
9b9f0da
doc: add bucket_logging to doc index
May 8, 2017
835b3d8
rgw: bl migrate atomic_t to std::atomic<>
May 9, 2017
501fc1c
rgw: bl expose key and version_id in the log
May 10, 2017
b737235
rgw: bl guard log record by http_status field
May 10, 2017
3e86ee9
rgw: bl introduce LDG(Log Delivery group) group user
ZVampirEM77 May 23, 2017
6eb1b0a
rgw: bl impl LDG op permission allocation
ZVampirEM77 May 23, 2017
d8e1055
rgw: bl impl verify LDG op permission
ZVampirEM77 May 23, 2017
bd28753
rgw: bl impl transformation from group flag to LDG uri
ZVampirEM77 May 23, 2017
6ef9a0b
rgw: bl fix log msg typos
ZVampirEM77 May 23, 2017
8be128a
rgw: bl keep PutBL response s3 compatible
ZVampirEM77 May 25, 2017
ca88253
rgw: bl check LDG permission to tbucket during uploading log obj
ZVampirEM77 Jun 5, 2017
fe9850c
rgw: bl impl log obj acl
ZVampirEM77 Jun 5, 2017
f4ef4f0
rgw: bl expose acl_error status reflect acl issue
ZVampirEM77 Jun 5, 2017
675aac7
rgw: bl fix log entry twice recorded bug
ZVampirEM77 Jun 6, 2017
f198d85
rgw: bl generate log obj key in second level
ZVampirEM77 Jun 8, 2017
c5edd25
rgw: bl impl upload opslog throttle
ZVampirEM77 Jun 8, 2017
25d855f
rgw: bl log entry time format compatible with s3
ZVampirEM77 Jun 8, 2017
fcd0b57
rgw: bl delete uploaded log obj when upload failed
ZVampirEM77 Jun 12, 2017
fdfac18
rgw: bl impl target grants inputing validity verified
ZVampirEM77 Jun 16, 2017
c19f601
rgw: bl add target grants into to_xml format
ZVampirEM77 Jun 16, 2017
e1431cf
rgw: bl add target grants into log obj acl
ZVampirEM77 Jun 16, 2017
07f480a
rgw: bl add target grants into GetBL returned msg
ZVampirEM77 Jun 16, 2017
4eaaa20
rgw: bl impl log obj acl grants quantitative limitation
ZVampirEM77 Jun 18, 2017
22c179d
rgw: bl fix log msg format issue
ZVampirEM77 Jun 18, 2017
69c7cf3
rgw: bl impl adding LDG grant to log obj acl by target grants
ZVampirEM77 Jun 18, 2017
7afc3be
rgw: bl verify grantee validation
ZVampirEM77 Jun 18, 2017
652bcf9
rgw: bl move definition of ACLGranteeType to header file
ZVampirEM77 Jun 22, 2017
deb3598
rgw: bl use ACLGranteeType instead of defining grantee_type_map
ZVampirEM77 Jun 22, 2017
931a758
rgw: bl add clean redundant define todo
ZVampirEM77 Jun 22, 2017
0c4d6a1
rgw: bl expose log pool ctx
ZVampirEM77 Jun 23, 2017
70b718a
rgw: bl add exclusive lock when write ops log obj
ZVampirEM77 Jun 23, 2017
c88b68f
rgw: bl add exclusive lock when read ops log obj
ZVampirEM77 Jun 23, 2017
9c0dcd7
rgw: bl impl different rgw write into different opslog
ZVampirEM77 Jun 23, 2017
8692dea
rgw: bl fix S3V4 auth failed issue
Jun 23, 2017
8204d6d
rgw: bl impl cls part of progress track
Jun 23, 2017
dc1548e
rgw: bl add request id for ops log
ZVampirEM77 Jun 7, 2017
8ab4629
rgw: bl enable ops log when bucket logging is enabled
Jun 28, 2017
4950ff8
rgw: bl set exclusive lock duration to 30 secs
ZVampirEM77 Jul 4, 2017
ce79d99
rgw: bl add size limitation to request xml params
ZVampirEM77 Jul 7, 2017
74186ff
rgw: bl req xml params size limitation error msg s3 compatibility
ZVampirEM77 Jul 7, 2017
828ab80
rgw: bl log_list_xxx log_remove log_show_xxx introduce rgw_pool params
ZVampirEM77 Jul 15, 2017
c94dbbb
rgw: bl make bucket logging compatible with ops log
ZVampirEM77 Jul 15, 2017
78e7064
rgw: bl make MAX_OPSLOG_UPLOAD_ENTRIES configable
Jul 7, 2017
e3e3185
rgw: bl support deliver by interval
ZVampirEM77 Jul 18, 2017
23009d8
rgw: bl fix deliver failure when prefix contains whitespace
ZVampirEM77 Aug 3, 2017
cf0c72a
rgw: bl make optional field using - when it's empty
Aug 9, 2017
d86d5c9
rgw: bl quote several fields to keep s3 compatible
Aug 17, 2017
ed2408f
rgw: bl make bucket logging totaltime a msec level record
ZVampirEM77 Sep 5, 2017
347672a
rgw: cleanup req_state::prot_flags to RGW_REST_SWIFT_AUTH for swift_auth
ZVampirEM77 Sep 7, 2017
f77c6ec
rgw: make req_state::prot_flags support all rgw_enable_apis protocol
ZVampirEM77 Sep 7, 2017
2e13acb
rgw: introduce prot_flags field into opslog entry
ZVampirEM77 Sep 7, 2017
9fb3645
rgw: track resource type during http route process
Sep 14, 2017
b8e7d66
rgw: record parsed http_method into opslog entry
Sep 15, 2017
97c68ba
rgw: opslog support record http_method/resource/prot_flag
Oct 18, 2017
2b137b1
rgw: bl make operation field s3 compatible
Oct 18, 2017
2bcf195
rgw: bl s/bl_deliver/bl-deliver/g
Oct 18, 2017
cc44e0f
rgw: add _t suffix for http_method/resource/prot_flag map
Oct 18, 2017
ab6b1b8
rgw: bl adopt to new random infra lib
Oct 18, 2017
ea2e6d2
rgw: bl cleaup dout/debug message
Oct 18, 2017
fc6a4a9
rgw: bl adopt to new rgw_to_asctime()
Oct 20, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 134 additions & 0 deletions doc/radosgw/bucket_logging.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
======================================
Server Access Logging / Bucket Logging
======================================

.. versionadded:: Mimic

The Ceph Object Gateway supports AWS S3 feature ``Server Access
Logging``, or so called ``Bucket Logging``.


Configuration
=============

Config Log Delivery Port
------------------------

We need to specify port which Ceph Object Gateway would use
to upload bucket logging file. For example, if we setup a Ceph cluster
by using ``vstart.sh`` script, it would start Ceph Object Gateway instance
on ``8000`` by default, so you need to add following config to ``ceph.conf`` ::

rgw bl url = "http://localhost:8000"


Create Bucket Logging Delivery User
-----------------------------------

The thread of Ceph Object Gateway which uploading bucket logging files
use `bl_deliver` typed S3 user. `bl_deliver` typed user has limited
permission, which can only upload objects(can't create bucket).

`bl_deliver` typed user can be created by specifing `--bl-deliver`
flag. For example::

$ radosgw-admin user create --uid=log-delivery-service --display-name="Bucket Logging Delivery" \
--bl-deliver
{
...
"user_id": "bl_deliver",
"display_name": "Bucket Logging Delivery",
"keys": [
{
"user": "log-delivery-service",
"access_key": "TGBG51N4F7V6DAKO5Y5D",
"secret_key": "9OYA8DW4CaxykOaWbUaEwIi8C5QpwPOU1pmCP6CV"
}
],
"bl_deliver": "true",
...
}


Add Bucket Logging Delivery User To Zone Config
-----------------------------------------------

After `bl_deliver` user creation,we need to config `bl_deliver` user
to Zone config, so that Ceph Object Gateway in the same Zone can share
`bl_deliver` user info. This can be done by ``radosgw-admin zone
modify`` command.

For example::

$ radosgw-admin zone modify --access-key=TGBG51N4F7V6DAKO5Y5D \
--secret=9OYA8DW4CaxykOaWbUaEwIi8C5QpwPOU1pmCP6CV \
--bl_deliver --rgw-zonegroup=default --rgw-zone=default

$ radosgw-admin zone get --rgw-zone=default
{
"id": "12d51989-9652-4921-8d6d-c4a4d356cc85",
"name": "default",
"bl_pool": "default.rgw.log:bl",
...
"bl_deliver_key": {
"access_key": "TGBG51N4F7V6DAKO5Y5D",
"secret_key": "9OYA8DW4CaxykOaWbUaEwIi8C5QpwPOU1pmCP6CV"
},
...
}

.. note:: A ``default`` zone is created for you if you have not done any
previous `Multisite Configuration`_.


Restart Ceph Object Gateway
---------------------------

After Zone config modification, we need to restart Ceph Object
Gateway. Then we can use following command to check whether Zone
modification is taken effect::

$ radosgw-admin zone get --rgw-zone=default
{
"id": "12d51989-9652-4921-8d6d-c4a4d356cc85",
"name": "default",
"bl_pool": "default.rgw.log:bl",
...
"bl_deliver_key": {
"access_key": "TGBG51N4F7V6DAKO5Y5D",
"secret_key": "9OYA8DW4CaxykOaWbUaEwIi8C5QpwPOU1pmCP6CV"
},
...
}


Usage
=====

All buckets that with bucket logging enabled can be found by
`radosgw-admin bl list` command, sample output are like following ::

$ radosgw-admin bl list
[
{ "bucket": ":111:7e7ad28f-b7db-44ad-81ac-96de39a13a12.4105.1", "status": "PROCESSING" }
,
{ "bucket": ":500:7e7ad28f-b7db-44ad-81ac-96de39a13a12.4121.2", "status": "UNINITIAL" }
,
{ "bucket": ":501:7e7ad28f-b7db-44ad-81ac-96de39a13a12.4121.3", "status": "UNINITIAL" }
,
{ "bucket": ":502:7e7ad28f-b7db-44ad-81ac-96de39a13a12.4121.4", "status": "UNINITIAL" }
,
{ "bucket": ":503:7e7ad28f-b7db-44ad-81ac-96de39a13a12.4121.5", "status": "UNINITIAL" }
,
{ "bucket": ":504:7e7ad28f-b7db-44ad-81ac-96de39a13a12.4121.6", "status": "UNINITIAL" }
,
{ "bucket": ":505:7e7ad28f-b7db-44ad-81ac-96de39a13a12.4121.7", "status": "UNINITIAL" }
]


We can also use following command to initiate a bucket logging delivery manually::

$ radosgw-admin bl process


.. _`Multisite Configuration`: ../multisite
1 change: 1 addition & 0 deletions doc/radosgw/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ you may write data with one API and retrieve it with the other.
Multi-tenancy <multitenancy>
Compression <compression>
LDAP Authentication <ldap-auth>
Bucket Logging <bucket_logging>
Server-Side Encryption <encryption>
Bucket Policy <bucketpolicy>
Dynamic bucket index resharding <dynamicresharding>
Expand Down
2 changes: 2 additions & 0 deletions doc/radosgw/s3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ The following table describes the support status for current Amazon S3 functiona
+---------------------------------+-----------------+----------------------------------------+
| **Policy (Buckets, Objects)** | Supported | ACLs & bucket policies are supported |
+---------------------------------+-----------------+----------------------------------------+
| **Bucket Logging** | Supported | |
+---------------------------------+-----------------+----------------------------------------+
| **Bucket Website** | Supported | |
+---------------------------------+-----------------+----------------------------------------+
| **Bucket ACLs (Get, Put)** | Supported | Different set of canned ACLs |
Expand Down
165 changes: 165 additions & 0 deletions src/cls/rgw/cls_rgw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3773,6 +3773,157 @@ static int rgw_get_bucket_resharding(cls_method_context_t hctx, bufferlist *in,
return 0;
}

static int rgw_cls_bl_set_entry(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
{
bufferlist::iterator in_iter = in->begin();

cls_rgw_bl_set_entry_op op;
try {
::decode(op, in_iter);
} catch (buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_bl_set_entry(): failed to decode op\n");
return -EINVAL;
}

bufferlist bl;
::encode(op.entry, bl);

int ret = cls_cxx_map_set_val(hctx, op.entry.first, &bl);
return ret;
}

static int rgw_cls_bl_rm_entry(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
{
bufferlist::iterator in_iter = in->begin();

cls_rgw_bl_rm_entry_op op;
try {
::decode(op, in_iter);
} catch (buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_bl_rm_entry(): failed to decode op\n");
return -EINVAL;
}

bufferlist bl;
::encode(op.entry, bl);

int ret = cls_cxx_map_remove_key(hctx, op.entry.first);
return ret;
}

static int rgw_cls_bl_get_next_entry(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
{
bufferlist::iterator in_iter = in->begin();
cls_rgw_bl_get_next_entry_ret op_ret;
cls_rgw_bl_get_next_entry_op op;
try {
::decode(op, in_iter);
} catch (buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_bl_get_next_entry(): failed to decode op\n");
return -EINVAL;
}

map<string, bufferlist> vals;
string filter_prefix;
bool more;
int ret = cls_cxx_map_get_vals(hctx, op.marker, filter_prefix,
1, &vals, &more);
if (ret < 0)
return ret;
map<string, bufferlist>::iterator it;
pair<string, int> entry;
if (!vals.empty()) {
it=vals.begin();
in_iter = it->second.begin();
try {
::decode(entry, in_iter);
} catch (buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_bl_get_next_entry(): failed to decode entry\n");
return -EIO;
}
}
op_ret.entry = entry;
::encode(op_ret, *out);
return 0;
}

static int rgw_cls_bl_list_entries(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
{
cls_rgw_bl_list_entries_op op;
bufferlist::iterator in_iter = in->begin();
try {
::decode(op, in_iter);
} catch (buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_bl_list_entries(): failed to decode op\n");
return -EINVAL;
}
cls_rgw_bl_list_entries_ret op_ret;
bufferlist::iterator iter;
map<string, bufferlist> vals;
string filter_prefix;
int ret = cls_cxx_map_get_vals(hctx, op.marker, filter_prefix,
op.max_entries, &vals, &op_ret.is_truncated);
if (ret < 0)
return ret;
map<string, bufferlist>::iterator it;
pair<string, int> entry;
for (it = vals.begin(); it != vals.end(); ++it) {
iter = it->second.begin();
try {
::decode(entry, iter);
} catch (buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_bl_list_entries(): failed to decode entry\n");
return -EIO;
}
op_ret.entries.insert(entry);
}
::encode(op_ret, *out);
return 0;
}

static int rgw_cls_bl_put_head(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
{
bufferlist::iterator in_iter = in->begin();

cls_rgw_bl_put_head_op op;
try {
::decode(op, in_iter);
} catch (buffer::error& err) {
CLS_LOG(1, "ERROR: rgw_cls_bl_put_head(): failed to decode entry\n");
return -EINVAL;
}

bufferlist bl;
::encode(op.head, bl);
int ret = cls_cxx_map_write_header(hctx,&bl);
return ret;
}

static int rgw_cls_bl_get_head(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
{
bufferlist bl;
int ret = cls_cxx_map_read_header(hctx, &bl);
if (ret < 0)
return ret;
cls_rgw_bl_obj_head head;
if (bl.length() != 0) {
bufferlist::iterator iter = bl.begin();
try {
::decode(head, iter);
} catch (buffer::error& err) {
CLS_LOG(0, "ERROR: rgw_cls_bl_get_head(): failed to decode entry %s\n",err.what());
return -EINVAL;
}
} else {
head.start_date = 0;
head.marker.clear();
}
cls_rgw_bl_get_head_ret op_ret;
op_ret.head = head;
::encode(op_ret, *out);
return 0;
}

CLS_INIT(rgw)
{
CLS_LOG(1, "Loaded rgw class!");
Expand Down Expand Up @@ -3822,6 +3973,12 @@ CLS_INIT(rgw)
cls_method_handle_t h_rgw_clear_bucket_resharding;
cls_method_handle_t h_rgw_guard_bucket_resharding;
cls_method_handle_t h_rgw_get_bucket_resharding;
cls_method_handle_t h_rgw_bl_set_entry;
cls_method_handle_t h_rgw_bl_rm_entry;
cls_method_handle_t h_rgw_bl_get_next_entry;
cls_method_handle_t h_rgw_bl_list_entries;
cls_method_handle_t h_rgw_bl_put_head;
cls_method_handle_t h_rgw_bl_get_head;


cls_register(RGW_CLASS, &h_class);
Expand Down Expand Up @@ -3888,6 +4045,14 @@ CLS_INIT(rgw)
cls_register_cxx_method(h_class, "get_bucket_resharding", CLS_METHOD_RD ,
rgw_get_bucket_resharding, &h_rgw_get_bucket_resharding);

/* bucket logging */
cls_register_cxx_method(h_class, RGW_BL_SET_ENTRY, CLS_METHOD_RD | CLS_METHOD_WR, rgw_cls_bl_set_entry, &h_rgw_bl_set_entry);
cls_register_cxx_method(h_class, RGW_BL_RM_ENTRY, CLS_METHOD_RD | CLS_METHOD_WR, rgw_cls_bl_rm_entry, &h_rgw_bl_rm_entry);
cls_register_cxx_method(h_class, RGW_BL_GET_NEXT_ENTRY, CLS_METHOD_RD, rgw_cls_bl_get_next_entry, &h_rgw_bl_get_next_entry);
cls_register_cxx_method(h_class, RGW_BL_LIST_ENTRIES, CLS_METHOD_RD, rgw_cls_bl_list_entries, &h_rgw_bl_list_entries);
cls_register_cxx_method(h_class, RGW_BL_PUT_HEAD, CLS_METHOD_RD| CLS_METHOD_WR, rgw_cls_bl_put_head, &h_rgw_bl_put_head);
cls_register_cxx_method(h_class, RGW_BL_GET_HEAD, CLS_METHOD_RD, rgw_cls_bl_get_head, &h_rgw_bl_get_head);

return;
}

Loading