iwla/docs/index.md

597 lines
14 KiB
Markdown
Raw Normal View History

2014-12-23 07:48:25 +01:00
iwla
====
Introduction
------------
2014-12-23 09:18:30 +01:00
iwla (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.
2014-12-23 07:48:25 +01:00
Nevertheless, 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).
Usage
-----
./iwla [-c|--clean-output] [-i|--stdin] [-f FILE|--file FILE] [-d LOGLEVEL|--log-level LOGLEVEL]
-c : Clean output (database and HTML) before starting
-i : Read data from stdin instead of conf.analyzed_filename
-f : Read data from FILE instead of conf.analyzed_filename
-d : Loglevel in ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']
Basic usage
-----------
In 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.
Main values to edit are :
* **analyzed_filename** : web server log
* **domaine_name** : domain name to filter
* **pre_analysis_hooks** : List of pre analysis hooks
* **post_analysis_hooks** : List of post analysis hooks
* **display_hooks** : List of display hooks
* **locale** : Displayed locale (_en_ or _fr_)
2014-12-23 09:18:30 +01:00
Then, you can launch iwla. Output HTML files are created in _output_ directory by default. To quickly see it, go into _output_ and type
2014-12-23 07:48:25 +01:00
python -m SimpleHTTPServer 8000
Open your favorite web browser at _http://localhost:8000_. Enjoy !
2014-12-23 09:18:30 +01:00
**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.
2014-12-23 07:48:25 +01:00
Interesting default configuration values
----------------------------------------
* **DB_ROOT** : Default database directory (default ./output_db)
2014-12-23 09:18:30 +01:00
* **DISPLAY_ROOT** : Default HTML output directory (default _./output_)
2014-12-23 07:48:25 +01:00
* **log_format** : Web server log format (nginx style). Default is apache log format
* **time_format** : Time format used in log format
* **pages_extensions** : Extensions that are considered as a HTML page (or result) in opposit to hits
* **viewed_http_codes** : HTTP codes that are cosidered OK (200, 304)
2014-12-23 09:18:30 +01:00
* **count_hit_only_visitors** : If False, don't count visitors that doesn't GET a page but resources only (images, rss...)
2014-12-23 07:48:25 +01:00
* **multimedia_files** : Multimedia extensions (not accounted as downloaded files)
* **css_path** : CSS path (you can add yours)
* **compress_output_files** : Files extensions to compress in gzip during display build
Plugins
-------
As previously described, plugins acts like UNIX pipes : statistics are constantly updated by each plugin to produce final result. We have three type of plugins :
* **Pre analysis plugins** : Called before generating days statistics. They are in charge to filter robots, crawlers, bad pages...
* **Post analysis plugins** : Called after basic statistics computation. They are in charge to enlight them with their own algorithms
* **Display plugins** : They are in charge to produce HTML files from statistics.
2014-12-23 09:18:30 +01:00
To use plugins, just insert their file name (without _.py_ extension) in _pre_analysis_hooks_, _post_analysis_hooks_ and _display_hooks_ lists in conf.py.
2014-12-23 07:48:25 +01:00
Statistics are stored in dictionaries :
* **month_stats** : Statistics of current analysed month
* **valid_visitor** : A subset of month_stats without robots
* **days_stats** : Statistics of current analysed day
* **visits** : All visitors with all of its requests
* **meta** : Final result of month statistics (by year)
Create a Plugins
----------------
2014-12-23 09:18:30 +01:00
To create a new plugin, it's necessary to subclass IPlugin (_iplugin.py) in the right directory (_plugins/xxx/yourPlugin.py_).
2014-12-23 07:48:25 +01:00
Plugins 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).
The 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.
For display plugins, a lot of code has been wrote in _display.py_ that simplify the creation on HTML blocks, tables and bar graphs.
Plugins
=======
Optional configuration values ends with *.
2014-12-31 14:52:14 +01:00
* iwla.py
* plugins/display/all_visits.py
* plugins/display/referers.py
* plugins/display/top_downloads.py
* plugins/display/top_hits.py
* plugins/display/top_pages.py
* plugins/display/top_visitors.py
* plugins/display/referers_diff.py
* plugins/post_analysis/referers.py
* plugins/post_analysis/reverse_dns.py
* plugins/post_analysis/top_downloads.py
* plugins/post_analysis/top_hits.py
* plugins/post_analysis/top_pages.py
* plugins/pre_analysis/page_to_hit.py
* plugins/pre_analysis/robots.py
2014-12-23 07:48:25 +01:00
iwla
----
Main class IWLA
Parse Log, compute them, call plugins and produce output
For now, only HTTP log are valid
Plugin requirements :
None
Conf values needed :
analyzed_filename
domain_name
locales_path
compress_output_files*
Output files :
DB_ROOT/meta.db
DB_ROOT/year/month/iwla.db
OUTPUT_ROOT/index.html
2014-12-31 14:52:14 +01:00
OUTPUT_ROOT/year/_stats.html
2014-12-23 07:48:25 +01:00
OUTPUT_ROOT/year/month/index.html
Statistics creation :
meta :
last_time
start_analysis_time
stats =>
year =>
month =>
viewed_bandwidth
not_viewed_bandwidth
viewed_pages
viewed_hits
nb_visits
nb_visitors
month_stats :
viewed_bandwidth
not_viewed_bandwidth
viewed_pages
viewed_hits
nb_visits
days_stats :
day =>
viewed_bandwidth
not_viewed_bandwidth
viewed_pages
viewed_hits
nb_visits
nb_visitors
visits :
remote_addr =>
remote_addr
remote_ip
viewed_pages
viewed_hits
not_viewed_pages
not_viewed_hits
bandwidth
last_access
requests =>
[fields_from_format_log]
extract_request =>
extract_uri
extract_parameters*
extract_referer* =>
extract_uri
extract_parameters*
robot
hit_only
is_page
valid_visitors:
month_stats without robot and hit only visitors (if not conf.count_hit_only_visitors)
Statistics update :
None
Statistics deletion :
None
2014-12-23 09:18:30 +01:00
plugins.display.all_visits
--------------------------
2014-12-23 07:48:25 +01:00
Display hook
2014-12-23 09:18:30 +01:00
Create All visits page
2014-12-23 07:48:25 +01:00
Plugin requirements :
2014-12-23 09:18:30 +01:00
None
2014-12-23 07:48:25 +01:00
Conf values needed :
2014-12-23 09:18:30 +01:00
display_visitor_ip*
2014-12-23 07:48:25 +01:00
Output files :
2014-12-23 09:18:30 +01:00
OUTPUT_ROOT/year/month/all_visits.html
2014-12-23 07:48:25 +01:00
OUTPUT_ROOT/year/month/index.html
Statistics creation :
None
Statistics update :
None
Statistics deletion :
None
2014-12-23 09:18:30 +01:00
plugins.display.referers
------------------------
2014-12-23 07:48:25 +01:00
Display hook
2014-12-23 09:18:30 +01:00
Create Referers page
2014-12-23 07:48:25 +01:00
Plugin requirements :
2014-12-23 09:18:30 +01:00
post_analysis/referers
2014-12-23 07:48:25 +01:00
Conf values needed :
2014-12-23 09:18:30 +01:00
max_referers_displayed*
create_all_referers_page*
max_key_phrases_displayed*
create_all_key_phrases_page*
2014-12-23 07:48:25 +01:00
Output files :
2014-12-23 09:18:30 +01:00
OUTPUT_ROOT/year/month/referers.html
OUTPUT_ROOT/year/month/key_phrases.html
2014-12-23 07:48:25 +01:00
OUTPUT_ROOT/year/month/index.html
Statistics creation :
None
Statistics update :
None
Statistics deletion :
None
2014-12-31 14:52:14 +01:00
plugins.display.top_downloads
-----------------------------
2014-12-23 07:48:25 +01:00
Display hook
2014-12-31 14:52:14 +01:00
Create TOP downloads page
2014-12-23 07:48:25 +01:00
Plugin requirements :
2014-12-31 14:52:14 +01:00
post_analysis/top_downloads
2014-12-23 07:48:25 +01:00
Conf values needed :
2014-12-31 14:52:14 +01:00
max_downloads_displayed*
create_all_downloads_page*
2014-12-23 07:48:25 +01:00
Output files :
2014-12-31 14:52:14 +01:00
OUTPUT_ROOT/year/month/top_downloads.html
2014-12-23 07:48:25 +01:00
OUTPUT_ROOT/year/month/index.html
Statistics creation :
None
Statistics update :
None
Statistics deletion :
None
2014-12-23 09:18:30 +01:00
plugins.display.top_hits
------------------------
2014-12-23 07:48:25 +01:00
Display hook
2014-12-23 09:18:30 +01:00
Create TOP hits page
2014-12-23 07:48:25 +01:00
Plugin requirements :
2014-12-23 09:18:30 +01:00
post_analysis/top_hits
2014-12-23 07:48:25 +01:00
Conf values needed :
2014-12-23 09:18:30 +01:00
max_hits_displayed*
create_all_hits_page*
2014-12-23 07:48:25 +01:00
Output files :
2014-12-23 09:18:30 +01:00
OUTPUT_ROOT/year/month/top_hits.html
2014-12-23 07:48:25 +01:00
OUTPUT_ROOT/year/month/index.html
Statistics creation :
None
Statistics update :
None
Statistics deletion :
None
2014-12-31 14:52:14 +01:00
plugins.display.top_pages
-------------------------
2014-12-23 07:48:25 +01:00
Display hook
2014-12-31 14:52:14 +01:00
Create TOP pages page
2014-12-23 07:48:25 +01:00
Plugin requirements :
2014-12-31 14:52:14 +01:00
post_analysis/top_pages
2014-12-23 07:48:25 +01:00
Conf values needed :
2014-12-31 14:52:14 +01:00
max_pages_displayed*
create_all_pages_page*
2014-12-23 07:48:25 +01:00
Output files :
2014-12-31 14:52:14 +01:00
OUTPUT_ROOT/year/month/top_pages.html
2014-12-23 07:48:25 +01:00
OUTPUT_ROOT/year/month/index.html
Statistics creation :
None
Statistics update :
None
Statistics deletion :
None
2014-12-31 14:52:14 +01:00
plugins.display.top_visitors
----------------------------
2014-12-23 07:48:25 +01:00
2014-12-31 14:52:14 +01:00
Display hook
Create TOP visitors block
2014-12-23 07:48:25 +01:00
Plugin requirements :
None
Conf values needed :
2014-12-31 14:52:14 +01:00
display_visitor_ip*
2014-12-23 07:48:25 +01:00
Output files :
2014-12-31 14:52:14 +01:00
OUTPUT_ROOT/year/month/index.html
2014-12-23 07:48:25 +01:00
Statistics creation :
None
Statistics update :
2014-12-31 14:52:14 +01:00
None
2014-12-23 07:48:25 +01:00
Statistics deletion :
None
2014-12-31 14:52:14 +01:00
plugins.display.referers_diff
-----------------------------
2014-12-23 07:48:25 +01:00
2014-12-31 14:52:14 +01:00
Display hook
2014-12-23 07:48:25 +01:00
2014-12-31 14:52:14 +01:00
Enlight new and updated key phrases in in all_key_phrases.html
2014-12-23 07:48:25 +01:00
Plugin requirements :
2014-12-31 14:52:14 +01:00
display/referers
2014-12-23 07:48:25 +01:00
Conf values needed :
2014-12-31 14:52:14 +01:00
None
2014-12-23 07:48:25 +01:00
Output files :
None
Statistics creation :
None
Statistics update :
2014-12-31 14:52:14 +01:00
None
2014-12-23 07:48:25 +01:00
Statistics deletion :
None
plugins.post_analysis.referers
------------------------------
Post analysis hook
Extract referers and key phrases from requests
Plugin requirements :
None
Conf values needed :
domain_name
Output files :
None
Statistics creation :
None
Statistics update :
month_stats :
referers =>
pages
hits
robots_referers =>
pages
hits
search_engine_referers =>
pages
hits
key_phrases =>
phrase
Statistics deletion :
None
2014-12-31 14:52:14 +01:00
plugins.post_analysis.reverse_dns
---------------------------------
2014-12-23 07:48:25 +01:00
Post analysis hook
2014-12-31 14:52:14 +01:00
Replace IP by reverse DNS names
2014-12-23 07:48:25 +01:00
Plugin requirements :
None
Conf values needed :
2014-12-31 14:52:14 +01:00
reverse_dns_timeout*
2014-12-23 07:48:25 +01:00
Output files :
None
Statistics creation :
None
Statistics update :
2014-12-31 14:52:14 +01:00
valid_visitors:
remote_addr
dns_name_replaced
dns_analyzed
2014-12-23 07:48:25 +01:00
Statistics deletion :
None
2014-12-31 14:52:14 +01:00
plugins.post_analysis.top_downloads
-----------------------------------
2014-12-23 07:48:25 +01:00
Post analysis hook
2014-12-31 14:52:14 +01:00
Count TOP downloads
2014-12-23 07:48:25 +01:00
Plugin requirements :
None
Conf values needed :
2014-12-31 14:52:14 +01:00
None
2014-12-23 07:48:25 +01:00
Output files :
None
Statistics creation :
None
Statistics update :
2014-12-31 14:52:14 +01:00
month_stats:
top_downloads =>
uri
2014-12-23 07:48:25 +01:00
Statistics deletion :
None
2014-12-23 09:18:30 +01:00
plugins.post_analysis.top_hits
------------------------------
2014-12-23 07:48:25 +01:00
2014-12-23 09:18:30 +01:00
Post analysis hook
Count TOP hits
2014-12-23 07:48:25 +01:00
Plugin requirements :
None
Conf values needed :
2014-12-23 09:18:30 +01:00
None
2014-12-23 07:48:25 +01:00
Output files :
None
Statistics creation :
None
Statistics update :
2014-12-23 09:18:30 +01:00
month_stats:
top_hits =>
uri
2014-12-23 07:48:25 +01:00
Statistics deletion :
None
2014-12-31 14:52:14 +01:00
plugins.post_analysis.top_pages
-------------------------------
2014-12-23 07:48:25 +01:00
2014-12-23 09:18:30 +01:00
Post analysis hook
2014-12-23 07:48:25 +01:00
2014-12-31 14:52:14 +01:00
Count TOP pages
2014-12-23 07:48:25 +01:00
Plugin requirements :
None
Conf values needed :
2014-12-23 09:18:30 +01:00
None
2014-12-23 07:48:25 +01:00
Output files :
None
Statistics creation :
None
Statistics update :
2014-12-23 09:18:30 +01:00
month_stats:
2014-12-31 14:52:14 +01:00
top_pages =>
2014-12-23 09:18:30 +01:00
uri
2014-12-23 07:48:25 +01:00
Statistics deletion :
None
2014-12-31 14:52:14 +01:00
plugins.pre_analysis.page_to_hit
--------------------------------
Pre analysis hook
Change page into hit and hit into page into statistics
Plugin requirements :
None
Conf values needed :
page_to_hit_conf*
hit_to_page_conf*
Output files :
None
Statistics creation :
None
Statistics update :
visits :
remote_addr =>
is_page
Statistics deletion :
None
plugins.pre_analysis.robots
---------------------------
Pre analysis hook
Filter robots
Plugin requirements :
None
Conf values needed :
page_to_hit_conf*
hit_to_page_conf*
Output files :
None
Statistics creation :
None
Statistics update :
visits :
remote_addr =>
robot
Statistics deletion :
None