rgw: opslog support record http_method/resource/prot_flag#17754
rgw: opslog support record http_method/resource/prot_flag#17754mikulely wants to merge 5 commits intoceph:masterfrom
Conversation
Signed-off-by: Enming Zhang <enming.zhang@umcloud.com>
Signed-off-by: Enming Zhang <enming.zhang@umcloud.com>
eg:
$ radosgw-admin log show
{
"bucket_id": "4a039cfd-ab25-408a-9b04-51b6983b4ed0.4134.1",
"bucket_owner": "tester",
"bucket": "swiftcontainer1",
"log_entries": [
{
"bucket": "swiftcontainer1",
"time": "2017-09-07 12:20:34.903364Z",
"time_local": "2017-09-07 20:20:34.903364",
"remote_addr": "127.0.0.1",
"user": "tester",
"operation": "PUT",
"uri": "/swift/v1/swiftcontainer1",
"http_status": "201",
"error_code": "Created",
"bytes_sent": 0,
"bytes_received": 0,
"object_size": 0,
"total_time": 157935,
"user_agent": "python-swiftclient-3.4.0",
"referrer": "",
"prot_flags": "SWIFT_REST"
}
],
"log_sum": {
"bytes_sent": 0,
"bytes_received": 0,
"total_time": 157935,
"total_entries": 1
}
}
Signed-off-by: Enming Zhang <enming.zhang@umcloud.com>
track resource type via following endpoints: + s3 + s3website + swift auth + admin Signed-off-by: Jiaying Ren <jiaying.ren@umcloud.com>
Signed-off-by: Jiaying Ren <jiaying.ren@umcloud.com>
9cbed34 to
1e65f73
Compare
| } | ||
|
|
||
| if (s->prot_flags & RGW_REST_SWIFT && ! quoted) { | ||
| if (s->prot_flags & (RGW_REST_SWIFT | RGW_REST_SWIFT_AUTH) |
There was a problem hiding this comment.
@ZVampirEM77 etag is not going to be sent on swift auth request.
|
|
||
| if (s->prot_flags & RGW_REST_SWIFT && !content_type) { | ||
| if (s->prot_flags & (RGW_REST_SWIFT | RGW_REST_SWIFT_AUTH) | ||
| && !content_type) { |
There was a problem hiding this comment.
@ZVampirEM77 have you seen an actual issue here, or are you just pairing SWIFT_AUTH with SWIFT? I'm not sure this is needed, or won't break things somewhere.
| formatter->dump_int("total_time", total_time); | ||
| formatter->dump_string("user_agent", entry.user_agent); | ||
| formatter->dump_string("referrer", entry.referrer); | ||
| formatter->dump_string("prot_flags", rgw_prot_flags[entry.prot_flags]); |
There was a problem hiding this comment.
@mikulely @ZVampirEM77 this is not going to work if flags have more than one bit set. Should generate a list of strings.
There was a problem hiding this comment.
@yehudasa in what conditions will flags have more than one bit set? i think there is a one-to-one correlation between a request and its protocol flags.
| ::encode(prot_flags, bl); | ||
| ENCODE_FINISH(bl); | ||
| } | ||
| void decode(bufferlist::iterator &p) { |
| formatter->dump_string("user_agent", entry.user_agent); | ||
| formatter->dump_string("referrer", entry.referrer); | ||
| formatter->dump_string("prot_flags", rgw_prot_flags[entry.prot_flags]); | ||
| formatter->dump_string("resource", rgw_resources[entry.resource]); |
There was a problem hiding this comment.
@mikulely need to search for entry.resource and only dump if exists in rgw_resources, otherwise will create a new entry.
| } | ||
|
|
||
| RGWOp *RGWHandler_Metadata::op_get() { | ||
| s->resource = RGW_RESOURCE_CATEGORY_METADATA; |
There was a problem hiding this comment.
there's a lot of duplicate stuff here, maybe can be moved into the constructor and when the handler is created you can pass in the req_state? Same goes to other handlers
| formatter->dump_string("referrer", entry.referrer); | ||
| formatter->dump_string("prot_flags", rgw_prot_flags[entry.prot_flags]); | ||
| formatter->dump_string("resource", rgw_resources[entry.resource]); | ||
| formatter->dump_string("http_method", rgw_http_methods[entry.http_method]); |
There was a problem hiding this comment.
@ZVampirEM77 how is this different from the original method string?
There was a problem hiding this comment.
@yehudasa the original method string is like OP_GET etc which is not compatible with AWS S3 GET
| int prot_flags; | ||
| headers_map x_headers; | ||
| int resource; | ||
| int http_method; |
There was a problem hiding this comment.
missing initialization, where resource is initialized.
There was a problem hiding this comment.
@yehudasa i think maybe you missed something. The entry. http_method is assigned in function rgw_log_op
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
|
This pull request has been automatically closed because there has been no activity for 90 days. Please feel free to reopen this pull request (or open a new one) if the proposed change is still appropriate. Thank you for your contribution! |
Add three fields to support the
Operationfield[1] of s3 bucketlogging(#14841).
before
rgw opslog:
get request from s3/s3website endpoint.
stored in the http request, which is a string)
after
we've add three new fields:
[1] http://docs.aws.amazon.com/AmazonS3/latest/dev/LogFormat.html