Module: check_mk
Branch: master
Commit: dd66975113da054d40a1fd2cb5262a780f9d3e79
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=dd66975113da05…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Thu Aug 30 16:43:13 2018 +0200
Nuked log_file global variable.
Note that for the NEB we still use Nagios' own log_file global variable,
because there is no other API for it.
Change-Id: I0662768be68feee005fcc6846381e7ecae486111
---
livestatus/src/LogCache.cc | 8 +++-----
livestatus/src/MonitoringCore.h | 1 +
livestatus/src/module.cc | 1 +
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/livestatus/src/LogCache.cc b/livestatus/src/LogCache.cc
index 8a0ce98..ec0358a 100644
--- a/livestatus/src/LogCache.cc
+++ b/livestatus/src/LogCache.cc
@@ -36,9 +36,6 @@ namespace {
constexpr unsigned long check_mem_cycle = 1000;
} // namespace
-// watch nagios' logfile rotation
-extern char *log_file;
-
int num_cached_log_messages = 0;
LogCache::LogCache(MonitoringCore *mc, unsigned long max_cached_messages)
@@ -66,7 +63,8 @@ bool LogCache::logCachePreChecks() {
updateLogfileIndex();
}
if (_logfiles.empty()) {
- Notice(logger()) << "no log file found, not even " <<
log_file;
+ Notice(logger()) << "no log file found, not even "
+ << _mc->historyFilePath();
}
return !_logfiles.empty();
}
@@ -82,7 +80,7 @@ void LogCache::updateLogfileIndex() {
_last_index_update = std::chrono::system_clock::now();
// We need to find all relevant logfiles. This includes directory, the
// current nagios.log and all files in the archive.
- scanLogfile(log_file, true);
+ scanLogfile(_mc->historyFilePath(), true);
fs::path dirpath = _mc->logArchivePath();
try {
diff --git a/livestatus/src/MonitoringCore.h b/livestatus/src/MonitoringCore.h
index 8ed4e80..2656884 100644
--- a/livestatus/src/MonitoringCore.h
+++ b/livestatus/src/MonitoringCore.h
@@ -100,6 +100,7 @@ public:
virtual std::string mkInventoryPath() = 0;
virtual std::string structuredStatusPath() = 0;
virtual std::string pnpPath() = 0;
+ virtual std::string historyFilePath() = 0;
virtual std::string logArchivePath() = 0;
virtual Encoding dataEncoding() = 0;
virtual size_t maxResponseSize() = 0;
diff --git a/livestatus/src/module.cc b/livestatus/src/module.cc
index afe5e8c..ef72d05 100644
--- a/livestatus/src/module.cc
+++ b/livestatus/src/module.cc
@@ -652,6 +652,7 @@ public:
return fl_structured_status_path;
}
std::string pnpPath() override { return fl_pnp_path; }
+ std::string historyFilePath() override { return log_file; }
std::string logArchivePath() override {
extern char *log_archive_path;
return log_archive_path;