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: add option to log custom HTTP headers (rgw_log_http_headers) #7639
Conversation
4ece0dc
to
94afdc9
Compare
I don't quite understand how to tie them together. IIUC, Apache's builtin logging won't capture arbitrary headers, though there are add-in modules that let you do that, of course? |
@mattbenjamin it's either built in, or through mod_log_config (or other module). We can do something within civetweb (which I'm not sure we want). Or maybe we can add the extra headers to the access log message that we dump (through the civetweb access log callback) |
0804373
to
e3468fe
Compare
@yehudasa rebased |
e3468fe
to
d38cf25
Compare
@yehudasa updated |
@yehudasa oops, repushed |
|
||
void encode(bufferlist &bl) const { | ||
ENCODE_START(8, 5, bl); | ||
ENCODE_START(9, 5, bl); // was 8 |
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.
@mattbenjamin remove this comment
if (struct_v >= 8) { | ||
::decode(object_owner, p); | ||
::decode(bucket_owner, p); | ||
if (struct_v >= 9) { |
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.
@mattbenjamin for code readability I'd prefer to avoid nested ifs like this, and with regular compile optimization it shouldn't affect execution time
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.
@yehudasa ok, I find this more readable, but I don't mind changing it
@@ -37,7 +37,7 @@ struct rgw_log_entry { | |||
headers_map x_headers; | |||
|
|||
void encode(bufferlist &bl) const { | |||
ENCODE_START(9, 5, bl); // was 8 | |||
ENCODE_START(9, 5, bl); |
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.
@mattbenjamin ah, this was already done
d38cf25
to
90bf95d
Compare
(mix up, ignore deleted) |
jenkins test this please (no logs) |
@yehudasa your most recent comments were deleted apparently by github; could you re-write the list of current blockers for this change? tia, Matt IIRC, one of the changes was to update docs. Pushed part of that. |
@yehudasa ARG. Will rebase by hand. |
c98057b
to
99da970
Compare
Tracks headers that should be handled conditionally (currently, can only log, so using minimal structure to represent the mapping). Adds map of custom headers to rgw_log_entry, and populate it with headers pre-selected for custom logging in RGWREST. Added to encoder and Formatter output. Some additional optimization possible. Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
Use this occasion of serialized map to implement encoders for boost::container::flat_map, which is optimized for in-order insertion. After some discussion, I'm proposing to just add the new template forms, rather than (e.g.) adding either a large amount of specialization machinery, or alternatively using C-style macros. Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
99da970
to
0d7de21
Compare
@yehudasa updated--I've verified this by hand, details below: ops logrgw enable ops log = true tested withsudo ncat -U /tmp/opslog prints:{"bucket":"bu_4","time":"2016-12-13 22:45:36.073961Z","time_local":"2016-12-13 17:45:36.073961","remote_addr":"","user":"testuser","operation":"PUT","uri":"/bu_4/bu_4_o32","http_status":"200","error_code":"","bytes_sent":0,"bytes_received":0,"object_size":21,"total_time":7699,"user_agent":"Boto/2.40.0 Python/2.7.11 Linux/4.6.6-200.fc23.x86_64","referrer":"","http_x_headers":[{"HTTP_CONTENT_MD5":"7FYUagKWrRgUAxkBdLZ80g=="},{"HTTP_EXPECT":"100-Continue"}]}, |
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.
@mattbenjamin lgtm. For some reason the signed-off-by test failed
@yehudasa huh, will update |
Explain the option for upstream doc. Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
0d7de21
to
04bf0f8
Compare
@yehudasa actually sign-off was present on the one marked bad, but I did notice that there was only the heading line and sign-off; maybe a parsing error? |
@mattbenjamin probably |
(adaptation commit for ceph#7639) Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
Tracks headers that should be handled conditionally (currently,
can only log, so using minimal structure to represent the
mapping).
Signed-off-by: Matt Benjamin mbenjamin@redhat.com