aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKerim Gokarslan <kgokarsl@cisco.com>2017-09-12 12:09:44 -0700
committerKerim Gokarslan <kgokarsl@cisco.com>2017-09-12 12:38:35 -0700
commitc89f0fb127bc2ca188486b702218322a4dafb5c4 (patch)
tree05f9dcfa87a59bea5a79835c96eaafe1d97c1ad7
parent5d415199cc02560553713956c4727fea17482d70 (diff)
NFVBENCH-23 Do not send runlogdate for logs about server status
Change-Id: I51cc104a9ade1481e075f200327b967c517857f4 Signed-off-by: Kerim Gokarslan <kgokarsl@cisco.com>
-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):