New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rgw: fix opslog uri as per Amazon s3 #16958
Conversation
dc221c3
to
3c8429d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
You forgot to specify request method
in the items listed in the commit message. I have corrected the PR Description. Please fix the commit message by yourself.
According to s3[1], current Request-URI opslog entry are missing: + request method + query string + http version number [1] http://docs.aws.amazon.com/AmazonS3/latest/dev/LogFormat.html Fixes: http://tracker.ceph.com/issues/20971 Reported-by: Zhang Shaowen <zhangshaowen@cmss.chinamobile.com> Signed-off-by: Jiaying Ren <jiaying.ren@umcloud.com>
@joscollin Thx! repushed. ;-) |
Jenkins retest this please |
src/rgw/rgw_log.cc
Outdated
|
||
uri.append(s->info.env->get("REQUEST_URI")); | ||
if(s->info.env->get("QUERY_STRING") && | ||
(strlen(s->info.env->get("QUERY_STRING")) != 0)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mikulely @joscollin instead of calling strlen() here, should do: *(const char *)s->info.env->get("QUERY_STRING")) != '\0'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mikulely @joscollin but should only call s->info.env->get("QUERY_STRING")
once, so put it in a temp variable first and then do the two checks and append on it
4c35a55
to
e2bba83
Compare
repushed. |
@joscollin @yehudasa ping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks better now. But could you please remove the unwanted lines introduced in rgw_log.cc
?
e2bba83
to
ba18047
Compare
src/rgw/rgw_log.cc
Outdated
@@ -357,6 +357,23 @@ int rgw_log_op(RGWRados *store, RGWREST* const rest, struct req_state *s, | |||
else | |||
set_param_str(s, "HTTP_REFERER", entry.referrer); | |||
set_param_str(s, "REQUEST_URI", entry.uri); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we unnecessarily setting entry.uri
here ? Correct me if I'm wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch!
ba18047
to
ddcbbe5
Compare
Jenkins, retest this please. |
retest this please |
Sigh. |
@@ -112,6 +112,7 @@ void RGWCivetWeb::init_env(CephContext *cct) | |||
|
|||
env.set("REMOTE_ADDR", info->remote_addr); | |||
env.set("REQUEST_METHOD", info->request_method); | |||
env.set("HTTP_VERSION", info->http_version); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please make a similar change to ClientIO::init_env()
in rgw_asio_client.cc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the upcoming new frontend? Yes!
2a3eef5
to
6800073
Compare
Jenkins, retest this please. |
@cbodley done |
src/rgw/rgw_log.cc
Outdated
uri.append("HTTP/"); | ||
uri.append(s->info.env->get("HTTP_VERSION")); | ||
|
||
entry.uri = uri; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since uri
is a temporary string, consider a move instead of copy here
According to s3[1], current Request-URI opslog entry are missing: + request method + query string + http version number [1] http://docs.aws.amazon.com/AmazonS3/latest/dev/LogFormat.html Fixes: http://tracker.ceph.com/issues/20971 Reported-by: Zhang Shaowen <zhangshaowen@cmss.chinamobile.com> Signed-off-by: Jiaying Ren <jiaying.ren@umcloud.com>
6800073
to
96bb12a
Compare
@cbodley done. |
According to Amazon s3[1], current Request-URI opslog entry are missing:
[1] http://docs.aws.amazon.com/AmazonS3/latest/dev/LogFormat.html
Fixes: http://tracker.ceph.com/issues/20971
Reported-by: Zhang Shaowen zhangshaowen@cmss.chinamobile.com
Signed-off-by: Jiaying Ren jiaying.ren@umcloud.com