iwla

iwla Git Source Tree

Root/docs/main.md

Source at commit 2180f9e7d4003ca4adb58c1da7bf3aa1f85023af created 6 years 8 months ago.
By Gregory Soutade, Update doc
1iwla
2====
3
4Introduction
5------------
6
7iwla (Intelligent Web Log Analyzer) is basically a clone of [awstats](http://www.awstats.org). The main problem with awstats is that it's a very monolothic project with everything in one big PERL file. In opposite, iwla has been though to be very modular : a small core analysis and a lot of filters. It can be viewed as UNIX pipes. Philosophy of iwla is : add, update, delete ! That's the job of each filter : modify statistics until final result. It's written in Python.
8
9Nevertheless, iwla is only focused on HTTP logs. It uses data (robots definitions, search engines definitions) and design from awstats. Moreover, it's not dynamic, but only generates static HTML page (with gzip compression option).
10
11Usage
12-----
13
14 ./iwla [-c|--clean-output] [-i|--stdin] [-f FILE|--file FILE] [-d LOGLEVEL|--log-level LOGLEVEL]
15
16 -c : Clean output (database and HTML) before starting
17 -i : Read data from stdin instead of conf.analyzed_filename
18 -f : Read data from FILE instead of conf.analyzed_filename
19 -d : Loglevel in ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']
20
21Basic usage
22-----------
23
24In addition to command line, iwla read parameters in default_conf.py. User can override default values using _conf.py_ file. Each module requires its own parameters.
25
26Main values to edit are :
27
28 * **analyzed_filename** : web server log
29 * **domaine_name** : domain name to filter
30 * **pre_analysis_hooks** : List of pre analysis hooks
31 * **post_analysis_hooks** : List of post analysis hooks
32 * **display_hooks** : List of display hooks
33 * **locale** : Displayed locale (_en_ or _fr_)
34
35Then, you can launch iwla. Output HTML files are created in _output_ directory by default. To quickly see it, go into _output_ and type
36
37 python -m SimpleHTTPServer 8000
38
39Open your favorite web browser at _http://localhost:8000_. Enjoy !
40
41**Warning** : The order in hooks list is important : Some plugins may requires others plugins, and the order of display_hooks is the order of displayed blocks in final result.
42
43
44Interesting default configuration values
45----------------------------------------
46
47 * **DB_ROOT** : Default database directory (default ./output_db)
48 * **DISPLAY_ROOT** : Default HTML output directory (default _./output_)
49 * **log_format** : Web server log format (nginx style). Default is apache log format
50 * **time_format** : Time format used in log format
51 * **pages_extensions** : Extensions that are considered as a HTML page (or result) in opposit to hits
52 * **viewed_http_codes** : HTTP codes that are cosidered OK (200, 304)
53 * **count_hit_only_visitors** : If False, don't count visitors that doesn't GET a page but resources only (images, rss...)
54 * **multimedia_files** : Multimedia extensions (not accounted as downloaded files)
55 * **css_path** : CSS path (you can add yours)
56 * **compress_output_files** : Files extensions to compress in gzip during display build
57
58Plugins
59-------
60
61As previously described, plugins acts like UNIX pipes : statistics are constantly updated by each plugin to produce final result. We have three type of plugins :
62
63 * **Pre analysis plugins** : Called before generating days statistics. They are in charge to filter robots, crawlers, bad pages...
64 * **Post analysis plugins** : Called after basic statistics computation. They are in charge to enlight them with their own algorithms
65 * **Display plugins** : They are in charge to produce HTML files from statistics.
66
67To use plugins, just insert their file name (without _.py_ extension) in _pre_analysis_hooks_, _post_analysis_hooks_ and _display_hooks_ lists in conf.py.
68
69Statistics are stored in dictionaries :
70
71 * **month_stats** : Statistics of current analysed month
72 * **valid_visitor** : A subset of month_stats without robots
73 * **days_stats** : Statistics of current analysed day
74 * **visits** : All visitors with all of its requests
75 * **meta** : Final result of month statistics (by year)
76
77Create a Plugins
78----------------
79
80To create a new plugin, it's necessary to subclass IPlugin (_iplugin.py) in the right directory (_plugins/xxx/yourPlugin.py_).
81
82Plugins can defines required configuration values (self.conf_requires) that must be set in conf.py (or can be optional). They can also defines required plugins (self.requires).
83
84The two functions to overload are _load(self)_ that must returns True or False if all is good (or not). It's called after _init_. The second is _hook(self)_ that is the body of plugins.
85
86For display plugins, a lot of code has been wrote in _display.py_ that simplify the creation on HTML blocks, tables and bar graphs.
87
88Plugins
89=======
90
91Optional configuration values ends with *.
92

Archive Download this file

Branches

Tags