Release status: beta
|Implementation||User activity, Special page|
|Description||Logs user access to MediaWiki|
|Author(s)||University of Macau (Aleksandar Bojinovic, Peter Kin-Fong Fong) (umdacctalk)|
|Last version||2.0 (2013-02-20)|
|MediaWiki||1.18 - 1.20
(1.15 - 1.18 for older versions)
|License||Educational Community License 2.0|
|Download||see Download section|
|Check usage and version matrix|
The Access Log extension adds a special page to MediaWiki. This special page, which is only accessible by certain privileged users, shows who read or edited a page, and when. It provides options to filter the list by user, action, and/or namespace, and limit the number of days to show. It also provides an option to purge old log entries.
The AccessLog extension is a MediaWiki Special Page. Only members of the 'sysop' group, and if set, members of the group defined in the $wgAccessControlPanelAllowedGroup variable, can access this special page. There are two ways to invoke this special page and view the access log:
- Directly navigate to the page 'Special:AccessLog'.
- Enter the 'Special Pages' page and click on the AccessLog special page.
The following shows the access log page, with the filter box:
Version History 
- Version 2.0 (2013-02-20)
- User can now filter logs by title, and choose to show or hide actions performed by anonymous users, logged-in users, and viewer themselves. Database schema is also changed to improve filtering efficiency.
- Version 1.0.2 (2012-01-06)
- Add anonymous logging option.
- Version 1.0.1 (2011-12-10)
- Minor bug fix.
- Version 1.0 (2011-11-02)
- First version, with basic logging function and log view page. Logs can be filtered by user, action, namespace and date.
- Access Log 2.0 (newer version, for MediaWiki 1.18 - 1.20)
- Access Log 1.0.2 (older version, for MediaWiki 1.15 - 1.18)
The AccessLog extension has the following requirements (besides the MediaWiki versions specified in the extension box):
- MySQL database servers are required; PostgreSQL and SQLite are not supported.
- MediaWiki database administrator access (or other database role that has privileges for creating SQL functions).
Step by Step Instruction 
Step 1: Download the archive file from the link above.
Step 2: Extract the downloaded archive to the extensions directory of your MediaWiki installation. For example (replace with the actual path to your MediaWiki installation):
unzip AccessLog-2.0.zip -d /path/to/mediawiki/extensions
Step 3: Add the following line to the bottom of LocalSettings.php (before the trailing ?>, if it is present):
$wgCachePages = false;
Step 5: Update the MediaWiki database by executing the update.php maintenance script.
Step 6: As an administrator (sysop) user, visit the page 'Special:AccessLog' in your MediaWiki installation. If everything went well you should see the AccessLog special page.
Step 7 (optional): By default, actions from anonymous users are ignored. To log actions from anonymous users, add the following line after the require_once statement of step 3:
$wgAccessLogAnons = true;
Step 8 (optional): If you are using the Access Control Panel extension, the members of $wgAccessControlPanelAllowedGroup can also access the access log page. If you are not using that extension, but want to grant access privilege to non-sysop users, create a new user group. Add the following lines to LocalSettings.php.
$wgAccessControlPanelAllowedGroup = 'ControlGroup'; $wgGroupPermissions[$wgAccessControlPanelAllowedGroup]['read'] = true; $wgGroupPermissions[$wgAccessControlPanelAllowedGroup]['edit'] = true;
After that, add user(s) who are going to read the access log into 'ControlGroup' (or whatever name you chose for this group). For detailed steps, please visit Help:Assigning permissions.
Upgrading from older versions 
Step 1: Download the newer version archive from the link above.
Step 2: Extract the downloaded archive to the extensions directory of your MediaWiki installation and replace the old version files. For example (replace with the actual path to your MediaWiki installation):
unzip -uo AccessLog-2.0.zip -d /path/to/mediawiki/extensions
Step 3: Update the MediaWiki database by executing the update.php maintenance script.
Step 4 (optional): In the previous step, newly introduced columns are filled with NULL values for old entries. Because of that, old entries will not be displayed when the log filter is used. To apply filters for old entries, update the old entries (fill in the newly introduced columns) by executing the updateLogRecord.php maintenance script.
|Caution:||This script makes use of user and page information in the database to fill in the missing columns, and does not guarantee correctness if those pieces of information were modified since the entries were logged.|
See also 
- Data Analytics and Collaborative Computing Group, University of Macau
- UMEduWiki: A package for a customized wiki for use in education, which includes the access log extension
I'm using this extension with PostgreSQL. You may try it a your own risk. Just edit the SQL file, changig the data types to look like this:
CREATE TABLE /*$wgDBprefix*/tw_accesslog ( tw_log_id SERIAL, -- Unique ID of log entry tw_log_timestamp varchar NOT NULL DEFAULT '19700101000000', -- timestamp of the action, in MediaWiki format tw_log_user int DEFAULT NULL, -- User ID of the action performer tw_log_username varchar NOT NULL, -- User name of the action performer tw_log_namespace int DEFAULT NULL, tw_log_title varchar NOT NULL, -- Title of the page tw_log_action varchar(32) NOT NULL, -- Name of action PRIMARY KEY (tw_log_id) ) /*$wgDBTableOptions*/; CREATE INDEX ON tw_accesslog (tw_log_timestamp); CREATE INDEX ON tw_accesslog (tw_log_user,tw_log_timestamp); CREATE INDEX ON tw_accesslog (tw_log_namespace,tw_log_timestamp); CREATE INDEX ON tw_accesslog (tw_log_title,tw_log_namespace,tw_log_timestamp);