diff options
author | mortenhillbom <mortenhillbom@gmail.com> | 2018-02-27 16:30:08 -0800 |
---|---|---|
committer | mortenhillbom <mortenhillbom@gmail.com> | 2018-02-27 16:34:21 -0800 |
commit | 1b35b646790002e960663a91b157eb209fcfc5a4 (patch) | |
tree | 2f967b8a8dbfd9c7f315e9740717b251b2c7d09f | |
parent | 0843235ecbb375d1d759a67791348e7812851029 (diff) |
NFVBENCH-71 Send runlogdate as date instead of 0
Change-Id: Ibb0845038ed9694309b04e360e71f6ff6f1d5a25
Signed-off-by: mortenhillbom <mortenhillbom@gmail.com>
-rw-r--r-- | nfvbench/fluentd.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/nfvbench/fluentd.py b/nfvbench/fluentd.py index 628b968..ad0ea34 100644 --- a/nfvbench/fluentd.py +++ b/nfvbench/fluentd.py @@ -35,7 +35,7 @@ class FluentLogHandler(logging.Handler): logging.Handler.__init__(self) self.log_senders = [] self.result_senders = [] - self.runlogdate = 0 + self.runlogdate = "1970-01-01T00:00:00.000000+0000" self.formatter = logging.Formatter('%(message)s') for fluentd_config in fluentd_configs: if fluentd_config.logging_tag: @@ -65,8 +65,9 @@ class FluentLogHandler(logging.Handler): "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: + # if runlogdate is Jan 1st 1970, it's a log from server (not an nfvbench run) + # so do not send runlogdate + if self.runlogdate != "1970-01-01T00:00:00.000000+0000": data["runlogdate"] = self.runlogdate self.__update_stats(record.levelno) @@ -103,9 +104,9 @@ 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) + # if runlogdate is Jan 1st 1970, it's a log from server (not an nfvbench run) # so don't send runlogdate - if self.runlogdate != 0: + if self.runlogdate != "1970-01-01T00:00:00.000000+0000": data["runlogdate"] = self.runlogdate for log_sender in self.log_senders: log_sender.emit(None, data) |