New Logstats plugin

This plugin is not maintained here anymore. Please check:

git repository of logstat

Logstats plugin

The logstats plugin provides a log file (NCSA combined i.e. like apache) of all access to dokuwiki pages. This way this file can be used to generate various statistics about the dokuwiki's usage.

A new plugin called statdisplay plugin is under development in order to compute statistics tables and bar graphs using the log file generated by logstats.

This plugin have been written using the information and code provided by Matthias Grimm at wiki:tips:logging

Author Jean-Françcois Lalande
Compatibility wiki:dokuwiki 2007-06-26 and later
Download logstats.tgz
Version 1.4 (14/06/2008)

How to use it ?


  • Log access into data/access.log
  • Some IPs can be ignored
  • Some users (logged) can be ignored
  • Some bots can be ignored


This plugin have not been tested on website with high traffic. It may impact the performance of your dokuwiki because each hit creates a line of ~150 bytes in data/access.log. You've been warned.


Install it as a regular dokuwiki plugin. You can unzip it in the lib/plugins directory or deploy it using the plugin interface of dokuwiki.

When installed, it will create the file data/access.log. If this file cannot be created by apache, when displaying a page, dokuwiki will die with an error. You must chmod your data/ directory like this:

chmod uog+w data

If no error appears then you have successfully installed the logstats plugin ! You should find some logs into data/access.log like this: - jf.lalande [01/Nov/2007:12:04:59 +0100] "GET ensib/home HTTP/1.1" 200 492 "home" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20070310 Iceweasel/ (Debian-" - jf.lalande [01/Nov/2007:12:26:16 +0100] "GET ensib/home HTTP/1.1" 200 492 "home" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20070310 Iceweasel/ (Debian-"


The configuration of this plugin can be managed directly in dokuwiki (see Configuration link in admin interfarce).

Log filename

You can change the filename of the log file using the $conf['plugin']['logstats']['accesslog'] variable:

$conf['plugin']['logstats']['accesslog'] = "data/other_access_file.log";

By default, if this variable is set to: data/access.log

Banned IP

You can ban som IP from beeing logged (for example your IP if you do not want to be consider as interesting web traffic). To do this, use the variable $conf['plugin']['logstats']['banned_ip'] which is a string containing all the banned ip, separated by a comma. Here is an example:

$conf['plugin']['logstats']['banned_ip'] = ",,";

Banned Users

You can ban som users (logged into dokuwiki) from beeing logged. To do this, use the variable $conf['plugin']['logstats']['banned_users'] which is a string containing all the banned users, separated by a comma. Here is an example:

$conf['plugin']['logstats']['banned_users'] = "bob,alice,gugu";

Banned agents (for bots)

You can ban som agents. It usefull for bots agents like google bot. To do this, use the variable $conf['plugin']['logstats']['banned_agents'] which is a string containing all the banned agent strings, separated by a comma. Here is an example:

$conf['plugin']['logstats']['banned_agents'] = "Googlebot,HooWWWer";



  • Make possible to log access hits into data/access.log
  • Implement this into an action plugin.
  • Give the possibility to ignore some IPs.
  • Manage the plugin configuration via the admin interface.
  • Check again the referrer detection. Maybe it's better to just put the referer without any detection.
  • Give the possibility to ignore some IPs using regex.
  • Generate html statistics with webalizer: if webalizer is installed, it would be great to generate the html files in a directory.
  • Generate statistics with a pure PHP analyzer: it seems that no pure-php script exists (I mean without perl, without mysql) to produce charts and statistics. see statdisplay plugin for this…

Possible statistics tools to use


Version 1.4

  • 14/06/2008 logstats_1.4.tgz
  • Frank Peters suggested me to add the possibility to ban agents. It is now possible using the configuration variable $conf['plugin']['logstats']['banned_agents'].

Version 1.3

  • 23/02/2008 logstats_1.3.tgz
  • Jendrik suggested me to add the possibility to ban users. It is now possible using the configuration variable $conf['plugin']['logstats']['banned_users'].

Version 1.2

  • 02/11/2007 logstats_1.2.tgz
  • I changed the configuration management. It is now configurable using the dokuwiki admin interface, as a regular plugin. Consequently, I had to rename the configuration option to $conf['plugin']['logstats']['accesslog'] and $conf['plugin']['logstats']['banned_ip'].

Version 1.1

  • 02/11/2007 logstats_1.1.tgz
  • Bug fix: when using the admin plugin manager, the file conf/local.php is read and written. If using an array in this conf file, the line is not kept correctly. So I decided to change the variable $conf['logstats_banned_ip'] which not any more an array but now a string containing all the banned IP separated by comma.
  • Improved HTTP referrer. It seems that Matthias have decided in his code to ignore referer that are not detected as a dokuwiki (i.e. he searched the regex “id=” in the referer). The referer (like google) was always empty. I changed this behavior: if no “id=” is detected, then I put the referer directly in the log.

Version 1.0


  • J.-F. Lalande
  • Matthias Grimm
  • Frank Peters (for banned agents)

Comments ? Wishes ?

You can report bugs, wishes using our TRAC dokustats development platform.

Or you can post a comment here if you prefer:

Hello! This is a great plugin. I have been using it since many weeks now and it just does fine! My question is: Is there any way to exclude a user from being logged by his name? I know that ip's can be banned, but those change and the username does not. Thank you very much! Done :)


just a quick suggestion, your plugin should respect dokuwikis savedir setting..

Hello! This is a great plugin and it workes fine! My question: Is there any way to exclude a Range of IP's (e.g. - for is a commalist with ~8000 entries ;-). Thank you very much! Frank I have added the function “Banned Agents”, its good for me. Frank

To be on the safe side, you should convert any occurrence of in the HTTP_USER_AGENT and REFERER to \”. Otherwise any in either field will cause the analysis program to misinterpret the data.


There is a little bug in the logstat system, and this problem makes statdisplay doesn't working.

In the case of USER is space spaced (example “SURNAME Firstname”) the explode(” ”) function isn't right.

I correct the problem in logstats by adding following row in /logstats/action.php line 276

$user = str_replace(" ", "_", $user);


Great plugin. But there is another bug in it.

I moved my 'data' folder out of public area (for security reason). Now it's located in ”../data”. After installing this plugin a error meassage appears: The data folder is not writable. After recreating the data folder all works.


HappyUser, 2012/01/17 03:53


I have the same problem as the above user, though I wasn't able to get it to work. I moved my 'data' folder out of the public area for security reasons and logstats can't seem to access it. I tried to chmod the folder as stated in the instructions and with “777” permissions (full access by all) temporarily to see if that would help.. it did not. I can't seem to get the plugin to access my normal data folder, even though the rest of the wiki does so just fine.

Any help is appreciated.

Jean-Paul Kirkbride, 2012/10/01 14:24

Hi, nice plugin, it's more simple to upgrade my dokuwikis now ! Great job ! thank you ! But something is missing for me : there is no stats on internal media files, there is only stats on wiki pages….

Enter your comment
wiki/logstats.txt · Last modified: 2012/12/03 09:35 (external edit)     Back to top