%META:TOPICINFO{author="TWikiContributor" date="1304406592" format="1.1" version="$Rev$"}%
---+!! <nop>%TOPIC%
<!--
   Contributions to this plugin are appreciated. Please update the plugin page at
   http://twiki.org/cgi-bin/view/Plugins/AccessStatsPlugin or provide feedback at
   http://twiki.org/cgi-bin/view/Plugins/AccessStatsPluginDev.
   If you are a TWiki contributor please update the plugin in the SVN repository.
-->
<sticky><div style="float:right; background-color:#EBEEF0; margin:0 0 20px 20px; padding: 0 10px 0 10px;">
%TOC{title="Page contents"}%
</div></sticky>
%SHORTDESCRIPTION%

---++ Introduction

The !AccessStatsPlugin provide statistics by parsing the Apache access log files. It gives the hit count for attachments or topics. One can also use the default parameter to count the number of line matching a regexp in the access log files. This is most useful if you want to monitor access to your web server. 

---++ Syntax Rules

Adds the following tag:
   * =%<nop>ACCESSSTATS%= - displays the number of successful access to the current topic.

Parameters:
   * =""= - specify a regexp to search the access log file with
   * =web=""= - specify web
   * =topic=""= - specify topic 
   * =attachment=""= - specify attachment

---++ Examples

   * =%<nop>ACCESSSTATS{"GET\s.+\s200\s"}%= - count the number of successful GET request.
   * =%<nop>ACCESSSTATS{web="MyWeb" topic="MyTopic"}%= - count the numer of successful GET request for specified web abd topic.
   * =%<nop>ACCESSSTATS{web="MyWeb" topic="MyTopic" attachment="MyAttachment"}%= - count the numer of successful GET request for specified attachment on specified web and topic.
   * =%<nop>ACCESSSTATS{attachment="MyAttachment"}%= - count the number of successful GET request for specified attachment in current topic.

---++ Plugin Installation Instructions

__Note:__ You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the TWiki server.

   * For an __automated installation__, run the [[%SCRIPTURL{configure}%][configure]] script and follow "Find More Extensions" in the in the __Extensions__ section.

   * Or, follow these __manual installation__ steps:
      * Download the ZIP file from the Plugins home (see below).
      * Unzip ==%TOPIC%.zip== in your twiki installation directory. Content:
        | *File:* | *Description:* |
        | ==data/TWiki/%TOPIC%.txt== | Plugin topic |
        | ==lib/TWiki/Plugins/%TOPIC%.pm== | Plugin Perl module |
      * Set the ownership of the extracted directories and files to the webserver user.

   * Plugin __configuration and testing__:
      * Run the [[%SCRIPTURL{configure}%][configure]] script, enable the plugin in the __Plugins__ section, and customize the following settings of !AccessStatsPlugin in the __Extensions__ section:%BR%
        ={Plugins}{AccessStatsPlugin}{Debug}= - default =0= %BR%
        ={Plugins}{AccessStatsPlugin}{LogFileName}= - default ='access_log'= %BR%
        ={Plugins}{AccessStatsPlugin}{LogDirectory}= - default ='/var/logs/httpd'= %BR%
        ={Plugins}{AccessStatsPlugin}{EnableRegexSearch}= - default =0=
      * Make sure the CGI user (www-data) has read permission to the log file.
      * Test if the installation was successful: See Usage Example above
   * Test if the installation was successful:
      * This page hit count: %ACCESSSTATS%

---++ Plugin Info

   * One line description, is shown in the %SYSTEMWEB%.TextFormattingRules topic:
      * Set SHORTDESCRIPTION = Show hit count for topics and attachments by parsing Apache access log files

|  Plugin Author: | TWiki:Main.StephaneLenclud |
|  Copyright: | &copy; 2006-2007, TWiki:Main.StephaneLenclud <br /> &copy; 2008-2011 TWiki:TWiki.TWikiContributor |
|  License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
|  Plugin Version: | 2011-05-03 |
|  Change History: | <!-- versions below in reverse order -->&nbsp; |
|  2011-05-03: | TWikibug:Item6701: Move settings to configure; doc improvements -- TWiki:Main.PeterThoeny |
|  9 Apr 2007 | Fixing issue with unzipped files like =access.log.n= not being parsed. |
|  21 Feb 2006: | Supports gz archived apache log file |
|  20 Feb 2006: | Now supports web, topic and attachment parameter |
|  18 Feb 2006: | Initial version |
|  TWiki Dependency: | $TWiki::Plugins::VERSION 1.1 |
|  CPAN Dependencies: | Compress::Zlib |
|  Other Dependencies: | none |
|  Perl Version: | 5.005 |
|  [[TWiki:Plugins/Benchmark][Benchmarks]]: | %SYSTEMWEB%.GoodStyle nn%, %SYSTEMWEB%.FormattedSearch nn%, %TOPIC% nn% |
|  Plugin Home: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC% |
|  Feedback: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Dev |
|  Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/%TOPIC%Appraisal |

__Related Topics:__ %SYSTEMWEB%.TWikiPlugins, %SYSTEMWEB%.DeveloperDocumentationCategory, %SYSTEMWEB%.AdminDocumentationCategory, %SYSTEMWEB%.TWikiPreferences, TWiki:Plugins.PageStatsPlugin, TWiki:Plugins.CounterPlugin
