From 3c5f117870f1ec1737d9c2edb90daf1573b4fc44 Mon Sep 17 00:00:00 2001 From: Gregory Soutade Date: Sun, 14 Dec 2014 15:28:12 +0100 Subject: [PATCH 1/4] Create display root before symlink css --- display.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/display.py b/display.py index 6343849..b0cca4c 100644 --- a/display.py +++ b/display.py @@ -312,6 +312,8 @@ class DisplayHTMLBuild(object): def build(self, root): display_root = self.iwla.getConfValue('DISPLAY_ROOT', '') + if not os.path.exists(display_root): + os.makedirs(display_root) for res_path in self.iwla.getResourcesPath(): target = os.path.abspath(res_path) link_name = os.path.join(display_root, res_path) From c221c813bf26b8d7702a248c848b2b4d43591792 Mon Sep 17 00:00:00 2001 From: Gregory Soutade Date: Sun, 14 Dec 2014 15:41:47 +0100 Subject: [PATCH 2/4] Don't account hits <= last_access (< before) --- iwla.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/iwla.py b/iwla.py index 93de2cd..81571be 100755 --- a/iwla.py +++ b/iwla.py @@ -551,10 +551,9 @@ class IWLA(object): self.current_analysis = self._deserialize(self.getDBFilename(t)) or self._clearVisits() self.analyse_started = True else: - if time.mktime(t) < time.mktime(cur_time): + if time.mktime(t) <= time.mktime(cur_time): return False - if not self.analyse_started: - self.analyse_started = True + self.analyse_started = True if cur_time.tm_mon != t.tm_mon: self._generateMonthStats() self.current_analysis = self._deserialize(self.getDBFilename(t)) or self._clearVisits() @@ -581,6 +580,8 @@ class IWLA(object): self.meta_infos = self._deserialize(conf.META_PATH) or self._clearMeta() if self.meta_infos['last_time']: + print 'Last time' + print self.meta_infos['last_time'] self.current_analysis = self._deserialize(self.getDBFilename(self.meta_infos['last_time'])) or self._clearVisits() else: self._clearVisits() @@ -609,8 +610,7 @@ class IWLA(object): del self.meta_infos['start_analysis_time'] self._serialize(self.meta_infos, conf.META_PATH) else: - print '==> Analyse not started : nothing to do' - self._generateMonthStats() + print '==> Analyse not started : nothing new' if __name__ == '__main__': parser = argparse.ArgumentParser(description='Intelligent Web Log Analyzer') From 2ab98c4090d5523aedcf762c4a54f63067ca1f28 Mon Sep 17 00:00:00 2001 From: Gregory Soutade Date: Sun, 14 Dec 2014 15:46:01 +0100 Subject: [PATCH 3/4] Add -f paramter --- iwla.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/iwla.py b/iwla.py index 81571be..42f5f2c 100755 --- a/iwla.py +++ b/iwla.py @@ -623,6 +623,9 @@ if __name__ == '__main__': default=False, help='Read data from stdin instead of conf.analyzed_filename') + parser.add_argument('-f', '--file', dest='file', + help='Analyse this log file') + args = parser.parse_args() if args.clean_output: @@ -638,8 +641,9 @@ if __name__ == '__main__': if args.stdin: iwla.start(sys.stdin) else: - if not os.path.exists(conf.analyzed_filename): - print 'No such file \'%s\'' % (conf.analyzed_filename) + filename = args.file or conf.analyzed_filename + if not os.path.exists(filename): + print 'No such file \'%s\'' % (filename) sys.exit(-1) - with open(conf.analyzed_filename) as f: + with open(filename) as f: iwla.start(f) From d4e3c0ecdd0cea7b43c45df32cd1bff24d5b9ba7 Mon Sep 17 00:00:00 2001 From: Gregory Soutade Date: Sun, 14 Dec 2014 15:46:44 +0100 Subject: [PATCH 4/4] Update TODO --- TODO | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/TODO b/TODO index f12a9cc..9e7b605 100644 --- a/TODO +++ b/TODO @@ -1,14 +1,9 @@ -reverse analysis --f option to read a file instead of the one in conf Other when pages truncated translations doc auto generation doc enhancement Limit hits/pages/downloads by rate Automatic tests -Test separate directory for DB and display quiet mode -Add 0 before month when < 10 Add Licence -Free memory as soon as possible -Bug in bandwidth account (x10) \ No newline at end of file +Free memory as soon as possible \ No newline at end of file