Don't save all visitors requests into database (save space and computing). Can be changed in deufalt_conf.py with keep_requests value
This commit is contained in:
parent
99639b65a4
commit
4d3c2107f0
|
@ -15,7 +15,7 @@ PRE_HOOK_DIRECTORY = HOOKS_ROOT + '.pre_analysis'
|
||||||
POST_HOOK_DIRECTORY = HOOKS_ROOT + '.post_analysis'
|
POST_HOOK_DIRECTORY = HOOKS_ROOT + '.post_analysis'
|
||||||
DISPLAY_HOOK_DIRECTORY = HOOKS_ROOT + '.display'
|
DISPLAY_HOOK_DIRECTORY = HOOKS_ROOT + '.display'
|
||||||
# Meta Database filename
|
# Meta Database filename
|
||||||
META_PATH = os.path.join(DB_ROOT, 'meta.db')
|
META_FILENAME = 'meta.db'
|
||||||
# Database filename per month
|
# Database filename per month
|
||||||
DB_FILENAME = 'iwla.db'
|
DB_FILENAME = 'iwla.db'
|
||||||
|
|
||||||
|
@ -60,3 +60,6 @@ locales_path = './locales'
|
||||||
|
|
||||||
# Default locale (english)
|
# Default locale (english)
|
||||||
locale = 'en_EN'
|
locale = 'en_EN'
|
||||||
|
|
||||||
|
# Don't keep requests of all visitors into database
|
||||||
|
keep_requests = False
|
||||||
|
|
7
iwla.py
7
iwla.py
|
@ -115,6 +115,7 @@ visits :
|
||||||
robot
|
robot
|
||||||
hit_only
|
hit_only
|
||||||
is_page
|
is_page
|
||||||
|
keep_requests
|
||||||
|
|
||||||
valid_visitors:
|
valid_visitors:
|
||||||
month_stats without robot and hit only visitors (if not conf.count_hit_only_visitors)
|
month_stats without robot and hit only visitors (if not conf.count_hit_only_visitors)
|
||||||
|
@ -646,6 +647,12 @@ class IWLA(object):
|
||||||
self._generateDisplay()
|
self._generateDisplay()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
for (k,v) in visits.items():
|
||||||
|
# Keep at least one request (for referers...)
|
||||||
|
if not v.get('keep_requests', conf.keep_requests):
|
||||||
|
if len(v['requests']) > 1:
|
||||||
|
v['requests'] = [v['requests'][0]]
|
||||||
|
|
||||||
path = self.getDBFilename(cur_time)
|
path = self.getDBFilename(cur_time)
|
||||||
|
|
||||||
self.logger.info("==> Serialize to %s" % (path))
|
self.logger.info("==> Serialize to %s" % (path))
|
||||||
|
|
|
@ -36,8 +36,7 @@ Plugin requirements :
|
||||||
None
|
None
|
||||||
|
|
||||||
Conf values needed :
|
Conf values needed :
|
||||||
page_to_hit_conf*
|
None
|
||||||
hit_to_page_conf*
|
|
||||||
|
|
||||||
Output files :
|
Output files :
|
||||||
None
|
None
|
||||||
|
@ -49,6 +48,7 @@ Statistics update :
|
||||||
visits :
|
visits :
|
||||||
remote_addr =>
|
remote_addr =>
|
||||||
robot
|
robot
|
||||||
|
keep_requests
|
||||||
|
|
||||||
Statistics deletion :
|
Statistics deletion :
|
||||||
None
|
None
|
||||||
|
@ -73,6 +73,7 @@ class IWLAPreAnalysisRobots(IPlugin):
|
||||||
|
|
||||||
self.logger.debug('%s is a robot (caller %s:%d)' % (k, info.function, info.lineno))
|
self.logger.debug('%s is a robot (caller %s:%d)' % (k, info.function, info.lineno))
|
||||||
super_hit['robot'] = 1
|
super_hit['robot'] = 1
|
||||||
|
super_hit['keep_requests'] = False
|
||||||
|
|
||||||
# Basic rule to detect robots
|
# Basic rule to detect robots
|
||||||
def hook(self):
|
def hook(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user