Module: check_mk
Branch: master
Commit: d825effcc58fcef0ff4f390e45038adfef90902d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d825effcc58fce…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Mar 6 16:56:26 2014 +0100
FIX cmc: fixed bug displaying logentries after a logfile rotation
The Check_MK microcore didn't cleanup cached logfiles correctly.
Thus caused missing logentries, when accessing views like
"Host and Service Events" or "Search global logfile".
The logentries itself were not lost, just unavailable in views.
The problem could be fixed by restarting (not reloading) the cmc.
---
.werks/730 | 14 ++++++++++++++
ChangeLog | 1 +
livestatus/src/LogCache.cc | 14 +++++++++++++-
3 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/.werks/730 b/.werks/730
new file mode 100644
index 0000000..4fe49e4
--- /dev/null
+++ b/.werks/730
@@ -0,0 +1,14 @@
+Title: cmc: fixed bug displaying logentries after a logfile rotation
+Level: 2
+Component: core
+Class: fix
+State: unknown
+Version: 1.2.5i1
+Date: 1394120989
+
+The Check_MK microcore didn't cleanup cached logfiles correctly.
+Thus caused missing logentries, when accessing views like
+"Host and Service Events" or "Search global logfile".
+
+The logentries itself were not lost, just unavailable in views.
+The problem could be fixed by restarting (not reloading) the cmc.
diff --git a/ChangeLog b/ChangeLog
index 9dd39a4..5559426 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -22,6 +22,7 @@
* 0682 FIX: Allow overriding of active and custom checks by more specific rule...
* 0267 FIX: Fixed auth.serials permission problem in check_mk standalone
installation...
* 0282 FIX: TIMEPERIOD TRANSITION messages no longer cut at 64 bytes...
+ * 0730 FIX: cmc: fixed bug displaying logentries after a logfile rotation...
Checks & Agents:
* 0306 esx_vsphere_counters: added missing ramdisk levels sfcbtickets
diff --git a/livestatus/src/LogCache.cc b/livestatus/src/LogCache.cc
index 9261be8..900ce25 100644
--- a/livestatus/src/LogCache.cc
+++ b/livestatus/src/LogCache.cc
@@ -38,10 +38,18 @@
#include "LogEntry.h"
#include "LogCache.h"
+#ifdef CMC
+#include "Core.h"
+extern Core *g_core;
+#else
+extern time_t last_log_rotation;
+#endif // CMC
+
+
+
#define CHECK_MEM_CYCLE 1000 /* Check memory every N'th new message */
// watch nagios' logfile rotation
-extern time_t last_log_rotation;
extern int g_debug_level;
extern char *log_archive_path;
extern char *log_file;
@@ -108,7 +116,11 @@ bool LogCache::logCachePreChecks()
// Has Nagios rotated logfiles? => Update
// our file index. And delete all memorized
// log messages.
+ #ifdef CMC
+ if (g_core->_last_logfile_rotation > _last_index_update) {
+ #else
if (last_log_rotation > _last_index_update) {
+ #endif
logger(LG_INFO, "Nagios has rotated logfiles. Rebuilding logfile
index");
forgetLogfiles();
updateLogfileIndex();