MediaWiki version: | ≥ 1.4 |
Every log action in MediaWiki is logged in thelogging table.Users can see those edits onSpecial:Log, except for a few restricted logs (like Special:Log/suppress).
The contents of this table is what you see on theSpecial:Log page.For example:
14:18, 25 June 2008 Jacksprat (Talk | contribs| block) uploaded "Image:Climb.jpg" (Added this image for the climbing page)
MediaWiki version: | ≥ 1.10 |
Primary key for the table.rc_logid is a foreign key linking to this column.
The type of the log action, or the "log type".
You can filter by some values of this type onSpecial:Log.
Comparable torc_log_type.
Example values fromsome Wikimedia wikis are as follows (including now-obsolete logs and several extensions):
The action performed.There may be multiple actions possible for a given type: for example, an entry with the typedelete may have the actiondelete orrestore, etc.Comparable torc_log_action.See alsoAPI:Logevents.SeeManual:Log actions.
The time the action was performed, in the timestamp format MediaWiki uses everywhere in the database: yyyymmddhhmmss ("14:18, 25 June 2008" in example).Has the same value as the correspondingrecentchanges.rc_timestamp andrevision.rev_timestamp.Does not necessarily have the same value as the correspondingimage.img_timestamp, in the case of file uploads.
MediaWiki version: | ≤ 1.33 |
Theid of the user who performed the action.This is a reference into theuser table (the user id of "Jacksprat" in example).Comparable torc_user andrev_user.
Deprecated in favor oflog_actor.
MediaWiki version: | ≥ 1.16 |
user_name of the user who performed the action, intended primarily for anonymous users, fillable by maintenance/populateLogUsertext.php.Comparable torc_user_text andrev_user_text.
Deprecated in favor oflog_actor.
MediaWiki version: | ≥ 1.31 Gerrit change 380669 |
This is a foreign key toactor_id in theactor table, corresponding to the user (registered or anonymous) who performed the action.
Thenamespace of the affected page.Together with log_title, this is a reference into thepage table ("Image:Climb.jpg" in example).Comparable torc_namespace.
logging
table may contain rows withlog_namespace
< 0:Thetitle of the affected page.Together with log_namespace, this is a reference into thepage table.Comparable torc_title
The title is also known as the log entry's 'target'.
For user blocks, this is the blocked user's username.For thanks action, this is the thanked user's username.
MediaWiki version: | ≥ 1.16 |
Thepage_id that this log action is about.Comparable torc_cur_id andrev_page.In the case of a page move, this is set to the page_id of the moved page (sinceGerrit change 157872).Formerly, it was the page_id of the redirect, or 0 if the page was moved without creating a redirect.
MediaWiki version: | ≤ 1.32 |
The comment given for the action; that is the upload comment for uploads, the deletion comment for deletions, etc.Comparable torc_comment andrev_comment.
(deprecated); log_comment_id and thecomment table should be used instead!
MediaWiki version: | ≥ 1.30 |
This is a foreign key tocomment_id in thecomment table.
MediaWiki version: | ≥ 1.5 |
Additional parameters, usually empty.Mirrored inrc_params.log_params is usually serialized, but not always; sometimes, for historical reasons, fields for log_params are separated by a newline.Anyone creating a new log type should use the PHP serialization.
For user blocks, log_params contains the duration of the block and other data, in human readable form, e.g. "2 weeks nocreate,noautoblock,noemail".For page moves, it contains a serialized array of the prefixed page title the page was moved to (i.e. inFULLPAGENAME format) and the boolean value ofnoredir
.For other examples, seeManual:Log parameters.
MediaWiki version: | ≥ 1.19 |
Since 1.19, data in log_params is in a different format.For instance, if you want to filter patrol/patrol log entries excluding autopatrol, pre-1.19 log entries need:
log.log_params LIKE '%\n0'
while entries added in 1.19 and further need (serialized PHP arrays):
log.log_params LIKE '%"6::auto";i:0%'
MediaWiki version: | ≥ 1.21 |
Since1.21, log_params is always serialized for newusers log too. An entry now looks like:
mysql> select log_params, log_action from logging where log_user = 4681690;+----------------------------------+------------+| log_params | log_action |+----------------------------------+------------+| a:1:{s:9:"4::userid";i:4681690;} | autocreate |+----------------------------------+------------+
while it used to look like:
mysql> select log_params, log_action from logging where log_user = 2298743;+------------+------------+| log_params | log_action |+------------+------------+| 2298743 | autocreate |+------------+------------+
The numbers, e.g. the 4 in "4::userid", are used as the argument number for message keys (e.g. $1, $2,...).The numbering should start with number 4, as the first three parameters are hardcoded for every message.If there is no message key, then a number should not be used. Some data contained in log_params are also contained inlog_search to facilitate indexed queries.Log parameters are typically set using functions such asManualLogEntry::setParameters() andLogPage::addEntry().
MediaWiki version: | ≥ 1.10 |
Used with theRevisionDelete system to delete log entries.Comparable torc_deleted andrev_deleted.It is a bit field. Take the sum of the following to determine what it represents:
For example, if the value is 6 (4+2), then the action would be visible, but the comment and user would not be unless you haddeletedhistory rights.
MediaWiki version: | ≥ 1.34 |
DESCRIBElogging;
+----------------+---------------------+------+-----+----------------+----------------+| Field | Type | Null | Key | Default | Extra |+----------------+---------------------+------+-----+----------------+----------------+| log_id | int(10) unsigned | NO | PRI | NULL | auto_increment || log_type | varbinary(32) | NO | MUL | | || log_action | varbinary(32) | NO | | | || log_timestamp | binary(14) | NO | MUL | 19700101000000 | || log_actor | bigint(20) unsigned | NO | MUL | NULL | || log_namespace | int(11) | NO | MUL | 0 | || log_title | varbinary(255) | NO | | | || log_page | int(10) unsigned | YES | MUL | NULL | || log_comment_id | bigint(20) unsigned | NO | | NULL | || log_params | blob | NO | | NULL | || log_deleted | tinyint(3) unsigned | NO | | 0 | |+----------------+---------------------+------+-----+----------------+----------------+
MediaWiki version: | 1.33 |
DESCRIBElogging;
+----------------+---------------------+------+-----+----------------+----------------+| Field | Type | Null | Key | Default | Extra |+----------------+---------------------+------+-----+----------------+----------------+| log_id | int(10) unsigned | NO | PRI | NULL | auto_increment || log_type | varbinary(32) | NO | MUL | | || log_action | varbinary(32) | NO | | | || log_timestamp | binary(14) | NO | MUL | 19700101000000 | || log_user | int(10) unsigned | NO | MUL | 0 | || log_user_text | varbinary(255) | NO | MUL | | || log_actor | bigint(20) unsigned | NO | MUL | 0 | || log_namespace | int(11) | NO | MUL | 0 | || log_title | varbinary(255) | NO | | | || log_page | int(10) unsigned | YES | MUL | NULL | || log_comment_id | bigint(20) unsigned | NO | | NULL | || log_params | blob | NO | | NULL | || log_deleted | tinyint(3) unsigned | NO | | 0 | |+----------------+---------------------+------+-----+----------------+----------------+
MediaWiki versions: | 1.31 – 1.32 |
DESCRIBElogging;
+----------------+---------------------+------+-----+----------------+----------------+| Field | Type | Null | Key | Default | Extra |+----------------+---------------------+------+-----+----------------+----------------+| log_id | int(10) unsigned | NO | PRI | NULL | auto_increment || log_type | varbinary(32) | NO | MUL | | || log_action | varbinary(32) | NO | | | || log_timestamp | binary(14) | NO | MUL | 19700101000000 | || log_user | int(10) unsigned | NO | MUL | 0 | || log_user_text | varbinary(255) | NO | MUL | | || log_actor | bigint(20) unsigned | NO | MUL | 0 | || log_namespace | int(11) | NO | MUL | 0 | || log_title | varbinary(255) | NO | | | || log_page | int(10) unsigned | YES | MUL | NULL | || log_comment | varbinary(767) | NO | | | || log_comment_id | bigint(20) unsigned | NO | | 0 | || log_params | blob | NO | | NULL | || log_deleted | tinyint(3) unsigned | NO | | 0 | |+----------------+---------------------+------+-----+----------------+----------------+
MediaWiki version: | 1.30 |
DESCRIBElogging;
+----------------+---------------------+------+-----+----------------+----------------+| Field | Type | Null | Key | Default | Extra |+----------------+---------------------+------+-----+----------------+----------------+| log_id | int(10) unsigned | NO | PRI | NULL | auto_increment || log_type | varbinary(32) | NO | MUL | | || log_action | varbinary(32) | NO | | | || log_timestamp | binary(14) | NO | MUL | 19700101000000 | || log_user | int(10) unsigned | NO | MUL | 0 | || log_user_text | varbinary(255) | NO | MUL | | || log_namespace | int(11) | NO | MUL | 0 | || log_title | varbinary(255) | NO | | | || log_page | int(10) unsigned | YES | MUL | NULL | || log_comment | varbinary(767) | NO | | | || log_comment_id | bigint(20) unsigned | NO | | 0 | || log_params | blob | NO | | NULL | || log_deleted | tinyint(3) unsigned | NO | | 0 | |+----------------+---------------------+------+-----+----------------+----------------+
MediaWiki versions: | 1.25 – 1.29 |
DESCRIBElogging;
+---------------+---------------------+------+-----+----------------+----------------+| Field | Type | Null | Key | Default | Extra |+---------------+---------------------+------+-----+----------------+----------------+| log_id | int(10) unsigned | NO | PRI | NULL | auto_increment || log_type | varbinary(32) | NO | MUL | | || log_action | varbinary(32) | NO | | | || log_timestamp | binary(14) | NO | MUL | 19700101000000 | || log_user | int(10) unsigned | NO | MUL | 0 | || log_user_text | varbinary(255) | NO | MUL | | || log_namespace | int(11) | NO | MUL | 0 | || log_title | varbinary(255) | NO | | | || log_page | int(10) unsigned | YES | MUL | NULL | || log_comment | varbinary(767) | NO | | | || log_params | blob | NO | | NULL | || log_deleted | tinyint(3) unsigned | NO | | 0 | |+---------------+---------------------+------+-----+----------------+----------------+
MediaWiki versions: | 1.23 – 1.24 |
DESCRIBElogging;
+---------------+---------------------+------+-----+----------------+----------------+| Field | Type | Null | Key | Default | Extra |+---------------+---------------------+------+-----+----------------+----------------+| log_id | int(10) unsigned | NO | PRI | NULL | auto_increment || log_type | varbinary(32) | NO | MUL | | || log_action | varbinary(32) | NO | | | || log_timestamp | binary(14) | NO | MUL | 19700101000000 | || log_user | int(10) unsigned | NO | MUL | 0 | || log_user_text | varbinary(255) | NO | MUL | | || log_namespace | int(11) | NO | MUL | 0 | || log_title | varbinary(255) | NO | | | || log_page | int(10) unsigned | YES | MUL | NULL | || log_comment | varbinary(255) | NO | | | || log_params | blob | NO | | NULL | || log_deleted | tinyint(3) unsigned | NO | | 0 | |+---------------+---------------------+------+-----+----------------+----------------+
MediaWiki versions: | 1.16 – 1.22 |
DESCRIBElogging;
+---------------+---------------------+------+-----+----------------+----------------+| Field | Type | Null | Key | Default | Extra |+---------------+---------------------+------+-----+----------------+----------------+| log_id | int(10) unsigned | NO | PRI | NULL | auto_increment || log_type | varbinary(32) | NO | MUL | | || log_action | varbinary(32) | NO | | | || log_timestamp | binary(14) | NO | MUL | 19700101000000 | || log_user | int(10) unsigned | NO | MUL | 0 | || log_user_text | varbinary(255) | NO | | | || log_namespace | int(11) | NO | MUL | 0 | || log_title | varbinary(255) | NO | | | || log_page | int(10) unsigned | YES | MUL | NULL | || log_comment | varbinary(255) | NO | | | || log_params | blob | NO | | NULL | || log_deleted | tinyint(3) unsigned | NO | | 0 | |+---------------+---------------------+------+-----+----------------+----------------+
MediaWiki versions: | 1.13 – 1.15 |
DESCRIBElogging;
+---------------+---------------------+------+-----+----------------+----------------+| Field | Type | Null | Key | Default | Extra |+---------------+---------------------+------+-----+----------------+----------------+| log_id | int(10) unsigned | NO | PRI | NULL | auto_increment || log_type | varbinary(10) | NO | MUL | | || log_action | varbinary(10) | NO | | | || log_timestamp | binary(14) | NO | MUL | 19700101000000 | || log_user | int(10) unsigned | NO | MUL | 0 | || log_namespace | int(11) | NO | MUL | 0 | || log_title | varbinary(255) | NO | | | || log_comment | varbinary(255) | NO | | | || log_params | blob | NO | | NULL | || log_deleted | tinyint(3) unsigned | NO | | 0 | |+---------------+---------------------+------+-----+----------------+----------------+
MediaWiki versions: | 1.10 – 1.12 |
DESCRIBElogging;
+---------------+---------------------+------+-----+----------------+----------------+| Field | Type | Null | Key | Default | Extra |+---------------+---------------------+------+-----+----------------+----------------+| log_id | int(10) unsigned | NO | PRI | NULL | auto_increment || log_type | varbinary(10) | NO | MUL | | || log_action | varbinary(10) | NO | | | || log_timestamp | binary(14) | NO | MUL | 19700101000000 | || log_user | int(10) unsigned | NO | MUL | 0 | || log_namespace | int(11) | NO | MUL | 0 | || log_title | varbinary(255) | NO | | | || log_comment | varbinary(255) | NO | | | || log_params | blob | NO | | NULL | || log_deleted | tinyint(3) unsigned | NO | | 0 | |+---------------+---------------------+------+-----+----------------+----------------+
MediaWiki versions: | 1.6 – 1.9 |
DESCRIBElogging;
+---------------+---------------------+------+-----+----------------+----------------+| Field | Type | Null | Key | Default | Extra |+---------------+---------------------+------+-----+----------------+----------------+| log_type | char(10) | NO | MUL | NULL | || log_action | char(10) | NO | | NULL | || log_timestamp | char(14) | NO | MUL | 19700101000000 | || log_user | int unsigned | NO | MUL | 0 | || log_namespace | int | NO | MUL | 0 | || log_title | varchar(255) binary | NO | | NULL | || log_comment | varchar(255) | NO | | NULL | || log_params | blob | NO | | NULL | |+---------------+---------------------+------+-----+----------------+----------------+
MediaWiki version: | 1.5 |
DESCRIBElogging;
+---------------+---------------------+------+-----+----------------+----------------+| Field | Type | Null | Key | Default | Extra |+---------------+---------------------+------+-----+----------------+----------------+| log_type | char(10) | NO | MUL | NULL | || log_action | char(10) | NO | | NULL | || log_timestamp | char(14) | NO | | 19700101000000 | || log_user | int unsigned | NO | MUL | 0 | || log_namespace | int(11) | NO | MUL | 0 | || log_title | varchar(255) binary | NO | | NULL | || log_comment | varchar(255) | NO | | NULL | || log_params | blob | NO | | NULL | |+---------------+---------------------+------+-----+----------------+----------------+
MediaWiki version: | 1.4 |
DESCRIBElogging;
+---------------+---------------------+------+-----+----------------+----------------+| Field | Type | Null | Key | Default | Extra |+---------------+---------------------+------+-----+----------------+----------------+| log_type | char(10) | NO | MUL | NULL | || log_action | char(10) | NO | | NULL | || log_timestamp | char(14) | NO | | 19700101000000 | || log_user | int unsigned | NO | MUL | 0 | || log_namespace | tinyint(?) unsigned | NO | MUL | 0 | || log_title | varchar(255) binary | NO | | NULL | || log_comment | varchar(255) | NO | | NULL | || log_params | blob | NO | | NULL | |+---------------+---------------------+------+-----+----------------+----------------+
MediaWiki version: | ≥ 1.36 |
SHOWINDEXINlogging;
+---------+------------+---------------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |+---------+------------+---------------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+| logging | 0 | PRIMARY | 1 | log_id | A | 0 | NULL | NULL | | BTREE | | || logging | 1 | log_type_time | 1 | log_type | A | 0 | NULL | NULL | | BTREE | | || logging | 1 | log_type_time | 2 | log_timestamp | A | 0 | NULL | NULL | | BTREE | | || logging | 1 | log_actor_time | 1 | log_actor | A | 0 | NULL | NULL | | BTREE | | || logging | 1 | log_actor_time | 2 | log_timestamp | A | 0 | NULL | NULL | | BTREE | | || logging | 1 | log_page_time | 1 | log_namespace | A | 0 | NULL | NULL | | BTREE | | || logging | 1 | log_page_time | 2 | log_title | A | 0 | NULL | NULL | | BTREE | | || logging | 1 | log_page_time | 3 | log_timestamp | A | 0 | NULL | NULL | | BTREE | | || logging | 1 | log_times | 1 | log_timestamp | A | 0 | NULL | NULL | | BTREE | | || logging | 1 | log_actor_type_time | 1 | log_actor | A | 0 | NULL | NULL | | BTREE | | || logging | 1 | log_actor_type_time | 2 | log_type | A | 0 | NULL | NULL | | BTREE | | || logging | 1 | log_actor_type_time | 3 | log_timestamp | A | 0 | NULL | NULL | | BTREE | | || logging | 1 | log_page_id_time | 1 | log_page | A | 0 | NULL | NULL | YES | BTREE | | || logging | 1 | log_page_id_time | 2 | log_timestamp | A | 0 | NULL | NULL | | BTREE | | || logging | 1 | log_type_action | 1 | log_type | A | 0 | NULL | NULL | | BTREE | | || logging | 1 | log_type_action | 2 | log_action | A | 0 | NULL | NULL | | BTREE | | || logging | 1 | log_type_action | 3 | log_timestamp | A | 0 | NULL | NULL | | BTREE | | |+---------+------------+---------------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+