]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: log of nonexsistent bucket config option
authorYehuda Sadeh <yehuda@hq.newdream.net>
Fri, 2 Sep 2011 19:18:00 +0000 (12:18 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Fri, 2 Sep 2011 19:18:43 +0000 (12:18 -0700)
src/common/config.cc
src/common/config.h
src/rgw/rgw_log.cc

index 8bfcc21423a601f430a17e3e2eecf6c07abed4c9..f618d9d2e40c370c5390b67e28f188e5f1bbb8c7 100644 (file)
@@ -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),
index 467789c7994443129697b127932affd13119ab12..b072edbff32584bb500f00c24342440712f525bc 100644 (file)
@@ -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.
index 8836c52a2cc5d273bfba79a79858c32ddc944844..a610e82d8dafef1b0e8a4471bcf9512b1a8bf82b 100644 (file)
@@ -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);