]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
RGW\logging: convert s3_filter to key_filter 60942/head
authorAli Masarwa <amasarwa@redhat.com>
Tue, 10 Dec 2024 13:09:50 +0000 (15:09 +0200)
committerAli Masarwa <amasarwa@redhat.com>
Tue, 17 Dec 2024 11:06:11 +0000 (13:06 +0200)
Signed-off-by: Ali Masarwa <amasarwa@redhat.com>
doc/radosgw/s3/bucketops.rst
examples/rgw/boto3/service-2.sdk-extras.json
src/rgw/rgw_bucket_logging.cc
src/rgw/rgw_bucket_logging.h

index 4f354f14dab74f8e8edbed80944de267480fbbdc..36b712ab4b7883b874ddb14cf2c56399a8003e95 100644 (file)
@@ -758,18 +758,6 @@ Parameters are XML encoded in the body of the request, in the following format:
             <Value></Value>
           </FilterRule>
         </S3Key>
-        <S3Metadata>
-          <FilterRule>
-            <Name></Name>
-            <Value></Value>
-          </FilterRule>
-        </S3Metadata>
-        <S3Tags>
-          <FilterRule>
-            <Name></Name>
-            <Value></Value>
-          </FilterRule>
-        </S3Tags>
       </Filter>
     </LoggingEnabled>
   </BucketLoggingStatus>
@@ -908,18 +896,6 @@ Response is XML encoded in the body of the request, in the following format:
             <Value></Value>
           </FilterRule>
         </S3Key>
-        <S3Metadata>
-          <FilterRule>
-            <Name></Name>
-            <Value></Value>
-          </FilterRule>
-        </S3Metadata>
-        <S3Tags>
-          <FilterRule>
-            <Name></Name>
-            <Value></Value>
-          </FilterRule>
-        </S3Tags>
       </Filter>
     </LoggingEnabled>
   </BucketLoggingStatus>
index 15aa6bc85380336282a8dca0070c1d1f485ead51..5decf6db9a7dacf614e4832f9dfd427ee1d0cf16 100644 (file)
                     "documentation":"indicates how many records to batch in memory before writing to the object. if set to zero, records are written syncronously to the object. if <code>ObjectRollTime</code>e is reached, the batch of records will be written to the object regardless of the number of records. </p>"
                 },
                 "Filter":{
-                    "shape":"NotificationConfigurationFilter",
-                    "documentation":"<p>A filter for all log object. Types of filter for the object by its: attributes, tags and key (prefix, suffix and regex).</p>"
+                    "shape":"LoggingConfigurationFilter",
+                    "documentation":"<p>A filter for all log object. Filter for the object by its key (prefix, suffix and regex).</p>"
                 }
             },
             "documentation":"<p>Describes where logs are stored the prefix assigned to all log object keys for a bucket, and their format. also, the level the delivery guarantee of the records.</p>"
                 "Standard",
                 "Journal"
             ]
+        },
+        "LoggingConfigurationFilter":{
+            "type":"structure",
+            "members":{
+                "Key":{
+                    "shape":"S3KeyFilter",
+                    "documentation":"<p/>",
+                    "locationName":"S3Key"
+                }
+            },
+            "documentation":"<p>A filter for all log object. Filter for the object by its key (prefix, suffix and regex).</p>",
+            "locationName":"Filter"
         }
     },
     "documentation":"<p/>"
index f63efeee9408dbf629ad956883b68b49103df016..d24a53024f1be81be58d54ae2f7f757c24f3670b 100644 (file)
@@ -31,7 +31,9 @@ bool configuration::decode_xml(XMLObj* obj) {
       logging_type = LoggingType::Standard;
     } else if (type == "Journal") {
       logging_type = LoggingType::Journal;
-      RGWXMLDecoder::decode_xml("Filter", s3_filter, o);
+      if (iter = o->find("Filter"); XMLObj* const filter_o = iter.get_next()) {
+        RGWXMLDecoder::decode_xml("S3Key", key_filter, filter_o);
+      }
     } else {
       // we don't allow for type "Any" in the configuration
       throw RGWXMLDecoder::err("invalid bucket logging record type: '" + type + "'");
@@ -74,8 +76,10 @@ void configuration::dump_xml(Formatter *f) const {
       break;
     case LoggingType::Journal:
       ::encode_xml("LoggingType", "Journal", f);
-      if (s3_filter.has_content()) {
-        ::encode_xml("Filter", s3_filter, f);
+      if (key_filter.has_content()) {
+        f->open_object_section("Filter");
+        ::encode_xml("S3Key", key_filter, f);
+        f->close_section(); // Filter
       }
       break;
     case LoggingType::Any:
@@ -122,8 +126,9 @@ void configuration::dump(Formatter *f) const {
         break;
       case LoggingType::Journal:
         encode_json("loggingType", "Journal", f);
-        if (s3_filter.has_content()) {
-          encode_json("Filter", s3_filter, f);
+        if (key_filter.has_content()) {
+          Formatter::ObjectSection s(*f, "Filter");
+          encode_json("S3Key", key_filter, f);
         }
         break;
       case LoggingType::Any:
@@ -533,8 +538,8 @@ int log_record(rgw::sal::Driver* driver,
     if (type != LoggingType::Any && configuration.logging_type != type) {
       return 0;
     }
-    if (configuration.s3_filter.has_content()) {
-      if (!match(configuration.s3_filter, obj)) {
+    if (configuration.key_filter.has_content()) {
+      if (!match(configuration.key_filter, obj->get_name())) {
         return 0;
       }
     }
index bedd5d3e0bd02966fafaf44b0671915652c6e052..d4877bafb0f258628245f847a989f9907c590e70 100644 (file)
@@ -50,24 +50,12 @@ namespace rgw::bucketlogging {
       <ObjectRollTime>integer</ObjectRollTime>          <!-- Ceph extension -->
       <RecordsBatchSize>integer</RecordsBatchSize>      <!-- Ceph extension -->
       <Filter>
-         <S3Key>
-            <FilterRule>
-               <Name>suffix/prefix/regex</Name>
-               <Value></Value>
-            </FilterRule>
-         </S3Key>
-         <S3Metadata>
-            <FilterRule>
-               <Name></Name>
-               <Value></Value>
-            </FilterRule>
-         </S3Metadata>
-         <S3Tags>
-            <FilterRule>
-               <Name></Name>
-               <Value></Value>
-            </FilterRule>
-         </S3Tags>
+        <S3Key>
+          <FilterRule>
+            <Name>suffix/prefix/regex</Name>
+            <Value></Value>
+          </FilterRule>
+        </S3Key>
       </Filter>
    </LoggingEnabled>
 </BucketLoggingStatus>
@@ -99,7 +87,7 @@ struct configuration {
   PartitionDateSource date_source = PartitionDateSource::DeliveryTime;
   // EventTime: use only year, month, and day. The hour, minutes and seconds are set to 00 in the key
   // DeliveryTime: the time the log object was created
-  rgw_s3_filter s3_filter;
+  rgw_s3_key_filter key_filter;
   bool decode_xml(XMLObj *obj);
   void dump_xml(Formatter *f) const;
   void dump(Formatter *f) const; // json
@@ -115,7 +103,7 @@ struct configuration {
     encode(records_batch_size, bl);
     encode(static_cast<int>(date_source), bl);
     if (logging_type == LoggingType::Journal) {
-      encode(s3_filter, bl);
+      encode(key_filter, bl);
     }
     ENCODE_FINISH(bl);
   }
@@ -134,7 +122,7 @@ struct configuration {
     decode(type, bl);
     date_source = static_cast<PartitionDateSource>(type);
     if (logging_type == LoggingType::Journal) {
-      decode(s3_filter, bl);
+      decode(key_filter, bl);
     }
     DECODE_FINISH(bl);
   }