Skip to content

Commit 9b7df3a

Browse files
committed
RGW\logging: adding transport layer fields
Signed-off-by: Ali Masarwa <[email protected]>
1 parent 0377e1c commit 9b7df3a

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/rgw/rgw_asio_frontend.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,16 @@ void handle_connection(boost::asio::io_context& context,
323323
rgw::io::add_conlen_controlling(
324324
&real_client))));
325325
RGWRestfulIO client(cct, &real_client_io);
326+
// getting ssl_cipher and tls_version
327+
if(is_ssl) {
328+
ceph_assert(typeid(Stream) == typeid(boost::asio::ssl::stream<tcp::socket&>));
329+
const SSL * native_handle = reinterpret_cast<const SSL *>(stream.native_handle());
330+
const auto ssl_cipher = SSL_CIPHER_get_name(SSL_get_current_cipher(native_handle));
331+
const auto tls_version = SSL_get_version(native_handle);
332+
auto& client_env = client.get_env();
333+
client_env.set("SSL_CIPHER", ssl_cipher);
334+
client_env.set("TLS_VERSION", tls_version);
335+
}
326336
optional_yield y = null_yield;
327337
if (cct->_conf->rgw_beast_enable_async) {
328338
y = optional_yield{yield};

src/rgw/rgw_bucket_logging.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,11 +419,11 @@ int log_record(rgw::sal::Driver* driver,
419419

420420
switch (conf.logging_type) {
421421
case LoggingType::Standard:
422-
record = fmt::format("{} {} [{:%d/%b/%Y:%H:%M:%S %z}] {} {} {} {} {} \"{} {}{}{} HTTP/1.1\" {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}",
422+
record = fmt::format("{} {} [{:%d/%b/%Y:%H:%M:%S %z}] {} {} {} {} {} \"{} {}{}{} HTTP/1.1\" {} {} {} {} {} {} {} \"{}\" {} {} {} {} {} {} {} {} {}",
423423
dash_if_empty(bucket_owner),
424424
dash_if_empty(bucket_name),
425425
t,
426-
"-", // no requester IP
426+
s->info.env->get("REMOTE_ADDR", "-"),
427427
dash_if_empty(user_or_account),
428428
dash_if_empty(s->req_id),
429429
op_name,
@@ -443,10 +443,10 @@ int log_record(rgw::sal::Driver* driver,
443443
dash_if_empty_or_null(obj, obj->get_instance()),
444444
s->info.x_meta_map.contains("x-amz-id-2") ? s->info.x_meta_map.at("x-amz-id-2") : "-",
445445
aws_version,
446-
"-", // TODO: SSL cipher. e.g. "ECDHE-RSA-AES128-GCM-SHA256"
446+
s->info.env->get("SSL_CIPHER", "-"),
447447
auth_type,
448448
dash_if_empty(fqdn),
449-
"-", // TODO: TLS version. e.g. "TLSv1.2" or "TLSv1.3"
449+
s->info.env->get("TLS_VERSION", "-"),
450450
"-", // no access point ARN
451451
(s->has_acl_header) ? "Yes" : "-");
452452
break;

0 commit comments

Comments
 (0)