From 1c809a5078d36c0f0590011d947c2b8b392dd07b Mon Sep 17 00:00:00 2001 From: Cory Snyder Date: Wed, 22 Sep 2021 10:14:12 -0400 Subject: [PATCH] rgw: add abstraction for ops log destination and add file logger Adds an OpsLogSink abstraction for ops log destinations. Also implements this abstraction for a file logger since it's easier to use files vs. sockets with containers. Fixes: https://tracker.ceph.com/issues/48752 Signed-off-by: Cory Snyder (cherry picked from commit c4c9f391aaa6983cf4ce0af144b70ecd27e76f45) Conflicts: src/common/options/rgw.yaml.in src/rgw/librgw.cc src/rgw/rgw_log.cc src/rgw/rgw_log.h src/rgw/rgw_lua_request.cc src/rgw/rgw_process.cc Cherry-pick notes: - Conflict due to change in configuration option specification between Pacific and master - Conflicts due to renaming RGWRados to rgw::sal::Store - Conflicts due to whitespace changes --- doc/radosgw/config-ref.rst | 7 + src/common/legacy_config_opts.h | 1 + src/common/options.cc | 8 +- src/rgw/librgw.cc | 19 ++- src/rgw/rgw_lib.h | 4 +- src/rgw/rgw_log.cc | 222 ++++++++++++++++++++++++-------- src/rgw/rgw_log.h | 69 +++++++++- src/rgw/rgw_lua_request.cc | 20 ++- src/rgw/rgw_lua_request.h | 4 +- src/rgw/rgw_main.cc | 16 ++- src/rgw/rgw_process.cc | 4 +- src/rgw/rgw_process.h | 6 +- src/test/fio/fio_librgw.cc | 2 +- 13 files changed, 293 insertions(+), 89 deletions(-) diff --git a/doc/radosgw/config-ref.rst b/doc/radosgw/config-ref.rst index e9d419fd3c064..1ed6085a6c767 100644 --- a/doc/radosgw/config-ref.rst +++ b/doc/radosgw/config-ref.rst @@ -804,6 +804,13 @@ Logging Settings :Default: None +``rgw_ops_log_file_path`` + +:Description: The file for writing operations logs. +:Type: String +:Default: None + + ``rgw_ops_log_data_backlog`` :Description: The maximum data backlog data size for operations logs written diff --git a/src/common/legacy_config_opts.h b/src/common/legacy_config_opts.h index f2610f33a7097..fc94fc112b04e 100644 --- a/src/common/legacy_config_opts.h +++ b/src/common/legacy_config_opts.h @@ -1405,6 +1405,7 @@ OPTION(rgw_usage_max_user_shards, OPT_INT) OPTION(rgw_enable_ops_log, OPT_BOOL) // enable logging every rgw operation OPTION(rgw_enable_usage_log, OPT_BOOL) // enable logging bandwidth usage OPTION(rgw_ops_log_rados, OPT_BOOL) // whether ops log should go to rados +OPTION(rgw_ops_log_file_path, OPT_STR) // path to file where ops log can go OPTION(rgw_ops_log_socket_path, OPT_STR) // path to unix domain socket where ops log can go OPTION(rgw_ops_log_data_backlog, OPT_INT) // max data backlog for ops log OPTION(rgw_fcgi_socket_backlog, OPT_INT) // socket backlog for fcgi diff --git a/src/common/options.cc b/src/common/options.cc index 1a13982179eee..1b2975a3c6ead 100644 --- a/src/common/options.cc +++ b/src/common/options.cc @@ -6509,6 +6509,12 @@ std::vector