From: Prashant D Date: Tue, 30 Aug 2022 07:29:24 +0000 (-0400) Subject: mon/LogMonitor: Fix log last X-Git-Tag: v17.2.6~17^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e5efbb13fe16e408ebda3dbdf4369226f77524e8;p=ceph.git mon/LogMonitor: Fix log last 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 (cherry picked from commit 32e40328fbdece9f6c573c11305ee525823e53c6) --- diff --git a/src/mon/LogMonitor.cc b/src/mon/LogMonitor.cc index 80e069d593af..2b628cebaafa 100644 --- a/src/mon/LogMonitor.cc +++ b/src/mon/LogMonitor.cc @@ -913,7 +913,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; @@ -934,6 +934,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 { @@ -965,10 +968,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"; + } } } }