]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/ops-log: explicitly specify object name in the log entry 50350/head
authorOguzhan Ozmen <oozmen@bloomberg.net>
Fri, 15 Sep 2023 17:25:52 +0000 (13:25 -0400)
committerOguzhan Ozmen <oozmen@bloomberg.net>
Mon, 18 Sep 2023 21:25:37 +0000 (17:25 -0400)
Pseudo-directories can be used when naming an object (key): e.g.,
"my/weird/object.txt". This would lead to cases where the name of the object
cannot be derived deterministically. For example, if an object name uses
pseudo-directories and starts with "<bucket_name>/" and virtual-host style is
used when accessing object, we cannot figure out the name of the object. Note
that in DNS (virtual host) style bucket naming, since bucket name is specified as
a part of the host name, URI doesn't contain any reference to the bucket.

boto_client = boto3.client(..., config=Config(s3={'addressing_style': 'virtual'}))

boto_client.put_object(
        Body=b"this is the data",
        Key="my-bucket/my-object",
        Bucket="my-bucket"
)

The corresponding log entry is

{   ...,
    "bucket":"my-bucket", ...,
    "uri":"PUT /my-bucket/my-object HTTP/1.1",
    ...
}

We can falsely conclude that the name of the object is "my-object".

By having the name of the object listed in the log-entry, we address
this ambiguity.

Signed-off-by: Oguzhan Ozmen <oozmen@bloomberg.net>
src/rgw/rgw_log.cc

index 1a3096f164c6dc9d6f89cf8b8b7d9024254a0fe8..9bc27bbe9ffa758bd37eebe72448131271554056 100644 (file)
@@ -251,6 +251,7 @@ void rgw_format_ops_log_entry(struct rgw_log_entry& entry, Formatter *formatter)
 {
   formatter->open_object_section("log_entry");
   formatter->dump_string("bucket", entry.bucket);
+  formatter->dump_string("object", entry.obj.name);
   {
     auto t = utime_t{entry.time};
     t.gmtime(formatter->dump_stream("time"));      // UTC