VisitorsLogging

Summary: How to have a clean log of visitor activity for each field of a farm
Version:
Prerequisites:
Status:
Maintainer:

Question

How can I have a clean log of my visitors activity for each field of my farm ?

Answer

Copy VisitorsLogging.phpΔ to the cookbook directory and add include_once("cookbook/VisitorsLogging.php"); to config.php.

Notes and Comments

Log output :

2005/07/19 10:54:28 78.232.205.160 edit Files.Miscellaneous
2005/07/19 10:54:48 78.232.205.160 browse Files.Miscellaneous

The script generates one logfile for each day, and deletes old logs automatically.

  • This recipe was last tested on PmWiki version: 2.1.5
  • This recipe requires at least PmWiki version: 2.0

Per-month directories

Setting:
 $VisitorsLoggingDirectory = "$WorkDir/VisitorsLogging/" . date("Y/m");

in config.php before calling the script with include_once will save every log file in a separate directory per month, i.e. "$WorkDir/VisitorsLogging/2007/01". --Petko January 15, 2007, at 03:13 AM

How to filter actions based on AuthId or Groupname, ...

SDV($VisitorsLoggingIgnoreAuthId, array('stephane@acme.com', 'steph'));
SDV($VisitorsLoggingIgnoreGroup, array('Main', 'Blog'));
...
if (in_array($AuthId, $VisitorsLoggingIgnoreAuthId) == true) return;
if (in_array(FmtPageName('$Group', $pagename), $VisitorsLoggingIgnoreGroup) == true) return;

See Also

Logging to a wiki page instead of a pure text file: Cookbook:ActionLog

The latest version is available at http://www.christophedavid.org/w/c/w.php/Files/VisitorsLoggingphp (Do not try to download this, rather point your browser at it - it's a html file displaying the code.) cda

Q: Where are the logs kept?
A: With the defaults set, the log text files are in wiki.d/VisitorsLogging/ DaveG

Q: I can't get a wikilink either, to list the directory, or to list a file 20060314.txt there. Any tips? /Dagge
A: My solution to this was to direct the log files to the directory uploads/VisitorsLogging instead. Then creating a page in the group VisitorsLogging with content (:attachlist:), you will get a nice list of your log files. You can then also apply the IncludeFile recipe to this to display the actual content of the log files. Note: you should make the uploads/VisitorsLogging read protected by adding a .htaccess file as described in SecureAttachments to prevent non-authorized users from viewing the logs. 13/08/2006 ThomasP

Contributors

Christophe David original script