]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: log host_bucket, http status
authorYehuda Sadeh <yehuda@hq.newdream.net>
Tue, 17 Jan 2012 01:46:49 +0000 (17:46 -0800)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Tue, 17 Jan 2012 17:56:16 +0000 (09:56 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
src/rgw/rgw_common.cc
src/rgw/rgw_main.cc

index 966a08a65ba60dc12279311e0f24e11f44c86216..f4f079e91704412fab8ebe173daad2d3a05c8d73 100644 (file)
@@ -103,6 +103,7 @@ req_state::req_state(struct RGWEnv *e) : acl(NULL), os_auth_token(NULL), os_user
   bucket_name = NULL;
   has_bad_meta = false;
   method = NULL;
+  host_bucket = NULL;
 }
 
 req_state::~req_state() {
index e003af347d2ac7260d31748fd3b7370095f96a8b..e1936ae6426b80bc43fc4836bb687ba072d80f1d 100644 (file)
@@ -70,8 +70,9 @@ struct RGWRequest
   uint64_t id;
   struct req_state *s;
   string req_str;
+  RGWOp *op;
 
-  RGWRequest() : id(0), s(NULL) {}
+  RGWRequest() : id(0), s(NULL), op(NULL) {}
 
   ~RGWRequest() {
     delete s;
@@ -82,13 +83,32 @@ struct RGWRequest
     return s;
   }
 
+  void log_format(struct req_state *s, const char *fmt, ...)
+  {
+#define LARGE_SIZE 1024
+    char buf[LARGE_SIZE];
+    va_list ap;
+    const char *format;
+
+    va_start(ap, fmt);
+    vsnprintf(buf, sizeof(buf), fmt, ap);
+    va_end(ap);
+
+    log(s, buf);
+  }
+
+
   void log(struct req_state *s, const char *msg) {
     if (s->method && req_str.size() == 0) {
       req_str = s->method;
       req_str.append(" ");
+      if (s->host_bucket) {
+        req_str.append(s->host_bucket);
+        req_str.append("/");
+      }
       req_str.append(s->request_uri);
     }
-    dout(1) << "req" << id << ":" << s->dialect << ":" << req_str << ":" << msg << dendl;
+    dout(1) << "r" << id << ":" << s->dialect << ":" << req_str << ":" << (op ? op->name() : "") << ":" << msg << dendl;
   }
 };
 
@@ -228,6 +248,7 @@ void RGWProcess::handle_request(RGWRequest *req)
     abort_early(s, -ERR_METHOD_NOT_ALLOWED);
     goto done;
   }
+  req->op = op;
 
   req->log(s, "authorizing");
   ret = handler->authorize();
@@ -273,6 +294,8 @@ done:
 
   int http_ret = s->err.http_ret;
 
+  req->log_format(s, "http status=%d", http_ret);
+
   handler->put_op(op);
   rgwstore->destroy_context(s->obj_ctx);
   FCGX_Finish_r(fcgx);