]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: don't log "config set" and "config-key set" dispatch and finished messages
authorNeha Ojha <nojha@redhat.com>
Thu, 3 Dec 2020 19:24:39 +0000 (19:24 +0000)
committerNeha Ojha <nojha@redhat.com>
Tue, 15 Dec 2020 16:02:15 +0000 (16:02 +0000)
Signed-off-by: Neha Ojha <nojha@redhat.com>
src/mon/Monitor.cc
src/mon/Monitor.h

index 6d8b83ca8b6ab3ecf7cea9510d789f9ce08caced..35023eac875f9aadd729efd7a0c5efbd1cbc3f06 100644 (file)
@@ -3410,18 +3410,20 @@ void Monitor::handle_command(MonOpRequestRef op)
   if (!_allowed_command(session, service, prefix, cmdmap,
                         param_str_map, mon_cmd)) {
     dout(1) << __func__ << " access denied" << dendl;
-    (cmd_is_rw ? audit_clog->info() : audit_clog->debug())
-      << "from='" << session->name << " " << session->addrs << "' "
-      << "entity='" << session->entity_name << "' "
-      << "cmd=" << m->cmd << ":  access denied";
+    if (prefix != "config set" && prefix != "config-key set")
+      (cmd_is_rw ? audit_clog->info() : audit_clog->debug())
+        << "from='" << session->name << " " << session->addrs << "' "
+        << "entity='" << session->entity_name << "' "
+        << "cmd=" << m->cmd << ":  access denied";
     reply_command(op, -EACCES, "access denied", 0);
     return;
   }
 
-  (cmd_is_rw ? audit_clog->info() : audit_clog->debug())
-      << "from='" << session->name << " " << session->addrs << "' "
-      << "entity='" << session->entity_name << "' "
-      << "cmd=" << m->cmd << ": dispatch";
+  if (prefix != "config set" && prefix != "config-key set")
+    (cmd_is_rw ? audit_clog->info() : audit_clog->debug())
+        << "from='" << session->name << " " << session->addrs << "' "
+        << "entity='" << session->entity_name << "' "
+        << "cmd=" << m->cmd << ": dispatch";
 
   // compat kludge for legacy clients trying to tell commands that are
   // new.  see bottom of MonCommands.h.  we need to handle both (1)
index 5043ab1efd68e8051b1120ad1d31761f6ab5cab9..edfb94ab81dbc90a5e1a1ad773fe85916be3f4f3 100644 (file)
@@ -42,6 +42,7 @@
 #include "MonCommand.h"
 
 
+#include "common/cmdparse.h"
 #include "common/config_obs.h"
 #include "common/LogClient.h"
 #include "auth/AuthClient.h"
@@ -869,7 +870,13 @@ public:
             ss << "session dropped for command ";
           }
         }
-        ss << "cmd='" << m->cmd << "': finished";
+        cmdmap_t cmdmap;
+        std::ostringstream ds;
+        string prefix;
+        ceph::common::cmdmap_from_json(m->cmd, &cmdmap, ds);
+        ceph::common::cmd_getval(cmdmap, "prefix", prefix);
+        if (prefix != "config set" && prefix != "config-key set")
+          ss << "cmd='" << m->cmd << "': finished";
 
         mon.audit_clog->info() << ss.str();
         mon.reply_command(op, rc, rs, rdata, version);