iwla

iwla Commit Details

Date:2014-11-20 15:25:43 (6 years 8 months ago)
Author:Grégory Soutadé
Branch:dev, master
Commit:4cc29487a298157892ea61f361fbfc05e262d8ff
Parents: f593cc78d93d02e080dcd3f71b2993eb4f8dc96b
Message:Externalise conf

Changes:
Aconf.py (full)
Miwla.py (4 diffs)

File differences

conf.py
1
2
3
4
5
6
7
8
9
10
11
12
log_format = '$server_name:$server_port $remote_addr - $remote_user [$time_local] ' +\
'"$request" $status $body_bytes_sent ' +\
'"$http_referer" "$http_user_agent"';
#09/Nov/2014:06:35:16 +0100
time_format = '%d/%b/%Y:%H:%M:%S +0100'
analyzed_filename = 'access.log'
DB_ROOT = './output/'
DISPLAY_ROOT = './output/'
iwla.py
1010
1111
1212
13
14
15
16
17
18
19
20
21
22
23
24
25
1326
1427
1528
......
1831
1932
2033
21
22
23
24
2534
2635
2736
28
29
30
3137
3238
3339
......
3844
3945
4046
41
42
4347
4448
4549
......
387391
388392
389393
390
394
391395
392396
393397
from robots import awstats_robots;
# Default configuration
DB_ROOT = './output/'
DISPLAY_ROOT = './output/'
log_format = '$server_name:$server_port $remote_addr - $remote_user [$time_local] ' +\
'"$request" $status $body_bytes_sent ' +\
'"$http_referer" "$http_user_agent"';
time_format = '%d/%b/%Y:%H:%M:%S +0100'
from conf import *
print '==> Start'
meta_visit = {}
cache_plugins = {}
display = {}
log_format = '$server_name:$server_port $remote_addr - $remote_user [$time_local] ' +\
'"$request" $status $body_bytes_sent ' +\
'"$http_referer" "$http_user_agent"';
log_format_extracted = re.sub(r'([^\$\w])', r'\\\g<1>', log_format);
log_format_extracted = re.sub(r'\$(\w+)', '(?P<\g<1>>.+)', log_format_extracted)
http_request_extracted = re.compile(r'(?P<http_method>\S+) (?P<http_uri>\S+) (?P<http_version>\S+)')
#09/Nov/2014:06:35:16 +0100
time_format = '%d/%b/%Y:%H:%M:%S +0100'
#print "Log format : " + log_format_extracted
log_re = re.compile(log_format_extracted)
uri_re = re.compile(r'(?P<extract_uri>[^\?]*)[\?(?P<extract_parameters>.*)]?')
PRE_HOOK_DIRECTORY = HOOKS_ROOT + 'pre_analysis/*.py'
POST_HOOK_DIRECTORY = HOOKS_ROOT + 'post_analysis/*.py'
DISPLAY_HOOK_DIRECTORY = HOOKS_ROOT + 'display/*.py'
DB_ROOT = './output/'
DISPLAY_ROOT = './output/'
META_PATH = DB_ROOT + 'meta.db'
DB_FILENAME = 'iwla.db'
current_visits = createEmptyVisits()
f = open("access.log")
f = open(analyzed_filename)
for l in f:
# print "line " + l;

Archive Download the corresponding diff file

Branches

Tags