summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nfvbench/fluentd.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/nfvbench/fluentd.py b/nfvbench/fluentd.py
index 06745ca..dc67008 100644
--- a/nfvbench/fluentd.py
+++ b/nfvbench/fluentd.py
@@ -50,11 +50,14 @@ class FluentLogHandler(logging.Handler):
def emit(self, record):
data = {
- "runlogdate": self.runlogdate,
"loglevel": record.levelname,
"message": self.formatter.format(record),
"@timestamp": self.__get_timestamp()
}
+ # if runlogdate is 0, it's a log from server (not an nfvbench run) so do not send runlogdate
+ if self.runlogdate != 0:
+ data["runlogdate"] = self.runlogdate
+
self.__update_stats(record.levelno)
self.sender.emit(None, data)
@@ -75,7 +78,6 @@ class FluentLogHandler(logging.Handler):
def send_run_summary(self, run_summary_required):
if run_summary_required or self.__get_highest_level() == logging.ERROR:
data = {
- "runlogdate": self.runlogdate,
"loglevel": "RUN_SUMMARY",
"message": self.__get_highest_level_desc(),
"numloglevel": self.__get_highest_level(),
@@ -83,6 +85,10 @@ class FluentLogHandler(logging.Handler):
"numwarnings": self.__warning_counter,
"@timestamp": self.__get_timestamp()
}
+ # if runlogdate is 0, it's a log from server (not an nfvbench run)
+ # so don't send runlogdate
+ if self.runlogdate != 0:
+ data["runlogdate"] = self.runlogdate
self.sender.emit(None, data)
def __get_highest_level(self):