Module: check_mk
Branch: master
Commit: 1f8c86ccd57223e3bea09d3cf6abb44c473dce46
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1f8c86ccd57223…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Nov 20 18:36:14 2013 +0100
FIX fixed problem with invalid logline classification
Two consecutive logfile queries, each with different logclasses,
could lead to invalid/missing logfile entries.
---
.werks/233 | 9 +++++++++
ChangeLog | 1 +
livestatus/src/LogEntry.cc | 18 ++++++------------
livestatus/src/LogEntry.h | 2 +-
livestatus/src/Logfile.cc | 2 +-
5 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/.werks/233 b/.werks/233
new file mode 100644
index 0000000..e069f59
--- /dev/null
+++ b/.werks/233
@@ -0,0 +1,9 @@
+Title: fixed problem with invalid logline classification
+Level: 2
+Component: livestatus
+Version: 1.2.3i7
+Date: 1384968812
+Class: fix
+
+Two consecutive logfile queries, each with different logclasses,
+could lead to invalid/missing logfile entries.
diff --git a/ChangeLog b/ChangeLog
index f4953e8..2c3230a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -80,6 +80,7 @@
* 0067 livedump: new option to mark the mode at the beginning of the dump and
documentation fixes...
* 0023 FIX: table statehist: code cleanup / minor performance improvements
* 0034 FIX: table statehist: no more missing entries if only one logfile exists
+ * 0233 FIX: fixed problem with invalid logline classification...
1.2.3i6:
diff --git a/livestatus/src/LogEntry.cc b/livestatus/src/LogEntry.cc
index 8ee3982..86b6482 100644
--- a/livestatus/src/LogEntry.cc
+++ b/livestatus/src/LogEntry.cc
@@ -31,7 +31,7 @@
#include "strutil.h"
#include "logger.h"
-LogEntry::LogEntry(unsigned lineno, char *line, unsigned logclasses = LOGCLASS_ALL)
+LogEntry::LogEntry(unsigned lineno, char *line)
{
// zero all elements as fast as possible -> default values
bzero(this, sizeof(LogEntry));
@@ -68,25 +68,19 @@ LogEntry::LogEntry(unsigned lineno, char *line, unsigned logclasses =
LOGCLASS_A
_time = atoi(_msg+1);
_text = _msg + 13; // also skip space after timestamp
- // If LOGCLASS_INFO is in logclasses we can't thin out the function calls
- logclasses = 1 << LOGCLASS_INFO & logclasses ? LOGCLASS_ALL : logclasses;
-
// now classify the log message. Some messages
// refer to other table, some do not.
- if (((1 << LOGCLASS_ALERT & logclasses) && handleStatusEntry()) ||
- ((1 << LOGCLASS_NOTIFICATION & logclasses) &&
handleNotificationEntry()) ||
- ((1 << LOGCLASS_PASSIVECHECK & logclasses) &&
handlePassiveCheckEntry()) ||
- ((1 << LOGCLASS_COMMAND & logclasses) &&
handleExternalCommandEntry())
+ if (handleStatusEntry() ||
+ handleNotificationEntry() ||
+ handlePassiveCheckEntry() ||
+ handleExternalCommandEntry()
)
{
updateReferences();
}
else {
- (1 << LOGCLASS_PROGRAM & logclasses) && handleProgrammEntry();
// Performance killer strstr!
- (1 << LOGCLASS_TEXT & logclasses) && handleTextEntry();
+ handleTextEntry() || handleProgrammEntry(); // Performance killer strstr in
handleProgrammEntry!
}
-
-
// rest is LOGCLASS_INFO
}
diff --git a/livestatus/src/LogEntry.h b/livestatus/src/LogEntry.h
index 1a3d18c..0b7c526 100644
--- a/livestatus/src/LogEntry.h
+++ b/livestatus/src/LogEntry.h
@@ -83,7 +83,7 @@ struct LogEntry
contact *_contact;
command *_command;
- LogEntry(unsigned lineno, char *line, unsigned logclasses);
+ LogEntry(unsigned lineno, char *line);
~LogEntry();
unsigned updateReferences();
diff --git a/livestatus/src/Logfile.cc b/livestatus/src/Logfile.cc
index 213cbaa..b0f84c9 100644
--- a/livestatus/src/Logfile.cc
+++ b/livestatus/src/Logfile.cc
@@ -174,7 +174,7 @@ long Logfile::freeMessages(unsigned logclasses)
inline bool Logfile::processLogLine(uint32_t lineno, unsigned logclasses)
{
- LogEntry *entry = new LogEntry(lineno, _linebuffer, logclasses);
+ LogEntry *entry = new LogEntry(lineno, _linebuffer);
// ignored invalid lines
if (entry->_logclass == LOGCLASS_INVALID) {
delete entry;