summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@hq.newdream.net>2011-09-02 12:18:00 -0700
committerYehuda Sadeh <yehuda@hq.newdream.net>2011-09-02 12:18:43 -0700
commit6506d43cbc2fd30b9907a1d0efe5d78ebf9fd6d3 (patch)
tree52e4db3c76872acdcc04abcfed5769f216049e2b
parent2641eb395dd604604dd107143f833ad423438bb4 (diff)
downloadceph-6506d43cbc2fd30b9907a1d0efe5d78ebf9fd6d3.tar.gz
rgw: log of nonexsistent bucket config option
-rw-r--r--src/common/config.cc1
-rw-r--r--src/common/config.h1
-rw-r--r--src/rgw/rgw_log.cc12
3 files changed, 11 insertions, 3 deletions
diff --git a/src/common/config.cc b/src/common/config.cc
index 8bfcc21423a..f618d9d2e40 100644
--- a/src/common/config.cc
+++ b/src/common/config.cc
@@ -437,6 +437,7 @@ struct config_option config_optionsp[] = {
OPTION(rgw_maintenance_tick_interval, OPT_DOUBLE, 10.0),
OPTION(rgw_pools_preallocate_max, OPT_INT, 100),
OPTION(rgw_pools_preallocate_threshold, OPT_INT, 70),
+ OPTION(rgw_log_nonexistent_bucket, OPT_BOOL, false),
// see config.h
OPTION(internal_safe_to_start_threads, OPT_BOOL, false),
diff --git a/src/common/config.h b/src/common/config.h
index 467789c7994..b072edbff32 100644
--- a/src/common/config.h
+++ b/src/common/config.h
@@ -571,6 +571,7 @@ public:
double rgw_maintenance_tick_interval;
int rgw_pools_preallocate_max;
int rgw_pools_preallocate_threshold;
+ bool rgw_log_nonexistent_bucket;
// This will be set to true when it is safe to start threads.
// Once it is true, it will never change.
diff --git a/src/rgw/rgw_log.cc b/src/rgw/rgw_log.cc
index 8836c52a2cc..a610e82d8da 100644
--- a/src/rgw/rgw_log.cc
+++ b/src/rgw/rgw_log.cc
@@ -17,6 +17,7 @@ static void set_param_str(struct req_state *s, const char *name, string& str)
int rgw_log_op(struct req_state *s)
{
struct rgw_log_entry entry;
+ uint64_t pool_id;
if (!s->should_log)
return 0;
@@ -26,8 +27,13 @@ int rgw_log_op(struct req_state *s)
return -EINVAL;
}
if (s->err.ret == -ERR_NO_SUCH_BUCKET) {
- RGW_LOG(0) << "bucket " << s->bucket << " doesn't exist, not logging" << dendl;
- return 0;
+ if (!g_conf->rgw_log_nonexistent_bucket) {
+ RGW_LOG(0) << "bucket " << s->bucket << " doesn't exist, not logging" << dendl;
+ return 0;
+ }
+ pool_id = 0;
+ } else {
+ pool_id = s->pool_id;
}
entry.bucket = s->bucket_name;
@@ -67,7 +73,7 @@ int rgw_log_op(struct req_state *s)
entry.http_status = "200"; // default
entry.error_code = s->err.s3_code;
- entry.pool_id = s->pool_id;
+ entry.pool_id = pool_id;
bufferlist bl;
::encode(entry, bl);