From e2ea89dbbe1b1731ba4eda7fbe40ea315594a1c9 Mon Sep 17 00:00:00 2001 From: navid Date: Thu, 22 Nov 2007 10:40:27 +0000 Subject: merged navid-dev back into trunk, see spec file for details git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@457 ef72aa8b-4018-0410-8976-d6e080ef94d8 --- .../sos-html-logs/lib/parsers/crazyclock_parser.py | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/extras/sos-html-logs/lib/parsers/crazyclock_parser.py (limited to 'src/extras/sos-html-logs/lib/parsers/crazyclock_parser.py') diff --git a/src/extras/sos-html-logs/lib/parsers/crazyclock_parser.py b/src/extras/sos-html-logs/lib/parsers/crazyclock_parser.py new file mode 100644 index 00000000..3e794a6f --- /dev/null +++ b/src/extras/sos-html-logs/lib/parsers/crazyclock_parser.py @@ -0,0 +1,24 @@ +import time +import soshtmllogs.parsers_base as parsers_base + +class crazyclock_Parser(parsers_base.base_Parser_class): + + def initialize(self): + # in this dict, we store the last date for each host + self.last_date = {} + + def parse_line(self, date, log): + + if date.date != log.date(): + self.add_event(log, "Time skew (%d seconds in the past)" % int(time.mktime(date.date) - time.mktime(log.date())), "color:purple; background-color:yellow") + + self.last_date[log.parent_host] = log.date() + + return + + def analyse_line(self, log): + + yield """The following line matched the rule:
""" + yield """
%s
""" % log.line + + yield "The logged time for this message is before the one for the previous message appearing in the log." -- cgit