]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/LogMonitor: Fix log last 47873/head
authorPrashant D <pdhange@redhat.com>
Tue, 30 Aug 2022 07:29:24 +0000 (03:29 -0400)
committerPrashant D <pdhange@redhat.com>
Tue, 30 Aug 2022 12:43:45 +0000 (08:43 -0400)
The ceph log last command outputs all the cluster
logs generated from logm entries at DBG level,
irrespective of their log level. We must output
cluster logs generated from logm according
to the log level specified in the log last command.

Fixes: https://tracker.ceph.com/issues/57340
Signed-off-by: Prashant D <pdhange@redhat.com>
src/mon/LogMonitor.cc

index e6d1029a1f7b30c5e3c38ccdda9ad41664bb38c5..99be08d17def9f260dafbff4d0094f7417bd01d0 100644 (file)
@@ -915,7 +915,7 @@ bool LogMonitor::preprocess_command(MonOpRequestRef op)
          } else {
            start = from;
          }
-         dout(10) << __func__ << " channnel " << p.first
+         dout(10) << __func__ << " channel " << p.first
                   << " from " << from << " to " << to << dendl;
          for (version_t v = start; v < to; ++v) {
            bufferlist ebl;
@@ -936,6 +936,9 @@ bool LogMonitor::preprocess_command(MonOpRequestRef op)
          entries.erase(entries.begin());
        }
        for (auto& p : entries) {
+         if (!match(p.second)) {
+           continue;
+         }
          if (f) {
            f->dump_object("entry", p.second);
          } else {
@@ -967,10 +970,12 @@ bool LogMonitor::preprocess_command(MonOpRequestRef op)
            LogEntry le;
            auto p = ebl.cbegin();
            decode(le, p);
-           if (f) {
-             f->dump_object("entry", le);
-           } else {
-             ss << le << "\n";
+           if (match(le)) {
+             if (f) {
+               f->dump_object("entry", le);
+             } else {
+               ss << le << "\n";
+             }
            }
          }
        }