diff options
author | navid <navid@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2007-11-22 10:40:27 +0000 |
---|---|---|
committer | navid <navid@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2007-11-22 10:40:27 +0000 |
commit | e2ea89dbbe1b1731ba4eda7fbe40ea315594a1c9 (patch) | |
tree | affd667e6f91c207a1c497ad895f336f0f386f59 /src/extras/sos-html-logs/lib/parsers/crazyclock_parser.py | |
parent | e60df25b9b22ec1bf78d8d95ca7673d559f13333 (diff) | |
download | sos-e2ea89dbbe1b1731ba4eda7fbe40ea315594a1c9.tar.gz |
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
Diffstat (limited to 'src/extras/sos-html-logs/lib/parsers/crazyclock_parser.py')
-rw-r--r-- | src/extras/sos-html-logs/lib/parsers/crazyclock_parser.py | 24 |
1 files changed, 24 insertions, 0 deletions
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:<BR>""" + yield """<DIV STYLE="margin-top: 10px; padding: 10px 10px 10px 10px; margin-bottom: 10px; background-color: white; border: 1px dotted black;">%s</B></DIV>""" % log.line + + yield "The logged time for this message is before the one for the previous message appearing in the log." |