diff options
author | Kerim Gokarslan <kgokarsl@cisco.com> | 2017-09-12 12:09:44 -0700 |
---|---|---|
committer | Kerim Gokarslan <kgokarsl@cisco.com> | 2017-09-12 12:38:35 -0700 |
commit | c89f0fb127bc2ca188486b702218322a4dafb5c4 (patch) | |
tree | 05f9dcfa87a59bea5a79835c96eaafe1d97c1ad7 | |
parent | 5d415199cc02560553713956c4727fea17482d70 (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.py | 10 |
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): |