Manual:logging table

From MediaWiki.org
Jump to: navigation, search

Other languages:
English • ‎français • ‎日本語 • ‎polski
Manual:ContentsManual:Contents MediaWiki database layoutManual:Database layout logging table


Every log action in MediaWiki is logged in the logging table. Users can see those edits on Special:Log, with the exception of a few restricted logs (like Special:Log/suppress).

The contents of this table is what you see on the Special:Log page. For example:

  • 14:18, 25 June 2008 Jacksprat (Talk | contribs| block) uploaded "Image:Climb.jpg" (Added this image for the climbing page)

Fields[edit]

log_id[edit]

MediaWiki version: 1.10

Primary key for the table. rc_logidManual:recentchanges table#rc_logid is a foreign key linking to this column.

log_type[edit]

The type of the log action, or the "log type". You can filter by this type on Special:Log. Typical values are: block, delete, import, makebot, move, newusers, protect, renameuser, rights, upload ("uploaded" in example) Comparable to rc_log_typeManual:Recentchanges table#rc_log_type. Values on itwiki, as of November 2014, are (including now-obsolete logs and several extensions):

MariaDB [itwiki_p]> SELECT DISTINCT log_type FROM logging;
+---------------+
| log_type      |
+---------------+
| abusefilter   |
| block         |
| delete        |
| gblblock      |
| import        |
| massmessage   |
| merge         |
| move          |
| newusers      |
| patrol        |
| protect       |
| renameuser    |
| rights        |
| spamblacklist |
| thanks        |
| upload        |
+---------------+
16 rows in set (0.01 sec)

log_action[edit]

The action performed. There may be multiple actions possible for a given type: for example, an entry with the type delete may have the action delete or restore, etc. Comparable to rc_log_actionManual:Recentchanges table#rc_log_action. See also API:Logevents#ParametersAPI:Logevents#Parameters. See Manual:Log actionsManual:Log actions.

log_timestamp[edit]

The time the action was performed, in the timestamp format MediaWiki uses everywhere in the database: yyyymmddhhmmss ("14:18, 25 June 2008" in example). Comparable to rc_timestampManual:recentchanges table#rc_timestamp and rev_timestampManual:revision table#rev_timestamp. If the log event is a file upload, this field is not necessarily the same as the image.img_timestamp generated by LocalFile::recordUpload2()Manual:LocalFile.php.

log_user[edit]

The idManual:User table#user_id of the user who performed the action. This is a reference into the userManual:User table table (the user id of "Jacksprat" in example). Comparable to rc_userManual:Recentchanges table#rc_user and rev_userManual:Revision table#rev_user.

log_user_text[edit]

MediaWiki version: 1.16

user_nameManual:User table#user_name of the user who performed the action, intended primarily for anonymous users, fillable by maintenance/populateLogUsertext.php. Comparable to rc_user_textManual:Recentchanges table#rc_user_text and rev_user_textManual:Revision table#rev_user_text.

log_namespace[edit]

The namespace of the affected page. Together with log_title, this is a reference into the pageManual:Page table table ("Image:Climb.jpg" in example). Comparable to rc_namespaceManual:Recentchanges_table#rc_namespace.

logging table may contain rows with log_namespace < 0:
  • Special:Renameuser with log_type and log_action being either "" or "renameuser"
  • Special:Userlogin with log_type being "newusers" and log_action e.g. being "create"

log_title[edit]

The titleManual:Page_table#page_title of the affected page. Together with log_namespace, this is a reference into the pageManual:Page table table. Comparable to rc_titleManual:Recentchanges_table#rc_title.

log_page[edit]

MediaWiki version: 1.16

The page_idManual:Page_table#page_id that this log action is about. Comparable to rc_cur_idManual:Recentchanges_table#rc_cur_id and rev_pageManual:Revision_table#rev_page. In the case of a page move, this is set to the page_id of the moved page (since Gerrit change 157872). Formerly, it was the page_id of the redirect, or 0 if the page was moved without creating a redirect.

log_comment[edit]

The comment given for the action; that is the upload comment for uploads, the deletion comment for deletions, etc. Comparable to rc_commentManual:Recentchanges_table#rc_comment and rev_commentManual:Revision_table#rev_comment.

log_params[edit]

MediaWiki version: 1.5

Additional parameters, usually empty. Mirrored in <tvar|params>rc_paramsManual:Recentchanges_table#rc_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. in FULLPAGENAME format) and the boolean value of noredir. For other examples, see Manual:Log parametersManual: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

Since 1.21MediaWiki 1.21/wmf9#Core changes, 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 in log_search to facilitate indexed queries. Log parameters are typically set using functions such as ManualLogEntry::setParameters()Manual:LogEntry.php and LogPage::addEntry()Manual:LogPage.php.

log_deleted[edit]

MediaWiki version: 1.10

Used with the revision delete system to delete log entries. This field is comparable to rc_deletedManual:Recentchanges_table#rc_deleted and rev_deletedManual:Revision_table#rev_deleted. It is a bit field. Take the sum of the following to determine what it represents:

  • 1 Action deleted
  • 2 Comment deleted
  • 4 User deleted
  • 8 If the deleted information is restricted. If this field is not set, then only deletedhistory right is needed, otherwise you need suppressrevision right. (On Wikimedia wikis, this corresponds to if admins can view the entry, or if only oversighters can)
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 had deletedhistory rights.

Schema summary[edit]

MediaWiki version: 1.25

DESCRIBE logging;

+---------------+---------------------+------+-----+----------------+----------------+
| Field         | Type                | Null | Key | Default        | Extra          |
+---------------+---------------------+------+-----+----------------+----------------+
| log_id        | int(10) unsigned    | NO   | PRI | NULL           | AUTO_INCREMENT |
| log_type      | varbinary(32)       | NO   | MUL | NULL           |                |
| log_action    | varbinary(32)       | NO   |     | NULL           |                |
| log_timestamp | binary(14)          | NO   | MUL | 19700101000000 |                |
| log_user      | int unsigned        | NO   | MUL | 0              |                |
| log_user_text | varchar(255) binary | NO   | MUL | NULL           |                |
| log_namespace | int                 | NO   | MUL | 0              |                |
| log_title     | varchar(255) binary | NO   | MUL | NULL           |                |
| log_page      | int unsigned        | YES  |     | NULL           |                |
| log_comment   | varbinary(767)      | NO   |     | NULL           |                |
| log_params    | blob                | NO   |     | NULL           |                |
| log_deleted   | tinyint(3) unsigned | NO   |     | 0              |                |
+---------------+---------------------+------+-----+----------------+----------------+


MediaWiki versions: 1.23 – 1.24

DESCRIBE logging;

+---------------+---------------------+------+-----+----------------+----------------+
| Field         | Type                | Null | Key | Default        | Extra          |
+---------------+---------------------+------+-----+----------------+----------------+
| log_id        | int(10) unsigned    | NO   | PRI | NULL           | AUTO_INCREMENT |
| log_type      | varbinary(32)       | NO   | MUL | NULL           |                |
| log_action    | varbinary(32)       | NO   |     | NULL           |                |
| log_timestamp | binary(14)          | NO   | MUL | 19700101000000 |                |
| log_user      | int unsigned        | NO   | MUL | 0              |                |
| log_user_text | varchar(255) binary | NO   | MUL | NULL           |                |
| log_namespace | int                 | NO   | MUL | 0              |                |
| log_title     | varchar(255) binary | NO   | MUL | NULL           |                |
| log_page      | int unsigned        | YES  |     | NULL           |                |
| log_comment   | varchar(255)        | NO   |     | NULL           |                |
| log_params    | blob                | NO   |     | NULL           |                |
| log_deleted   | tinyint(3) unsigned | NO   |     | 0              |                |
+---------------+---------------------+------+-----+----------------+----------------+


MediaWiki versions: 1.16 – 1.22

DESCRIBE logging;

+---------------+---------------------+------+-----+----------------+----------------+
| Field         | Type                | Null | Key | Default        | Extra          |
+---------------+---------------------+------+-----+----------------+----------------+
| log_id        | int(10) unsigned    | NO   | PRI | NULL           | AUTO_INCREMENT |
| log_type      | varbinary(32)       | NO   | MUL | NULL           |                |
| log_action    | varbinary(32)       | NO   |     | NULL           |                |
| log_timestamp | binary(14)          | NO   | MUL | 19700101000000 |                |
| log_user      | int unsigned        | NO   | MUL | 0              |                |
| log_user_text | varchar(255) binary | NO   |     | NULL           |                |
| log_namespace | int                 | NO   | MUL | 0              |                |
| log_title     | varchar(255) binary | NO   | MUL | NULL           |                |
| log_page      | int unsigned        | YES  |     | NULL           |                |
| log_comment   | varchar(255)        | NO   |     | NULL           |                |
| log_params    | blob                | NO   |     | NULL           |                |
| log_deleted   | tinyint(3) unsigned | NO   |     | 0              |                |
+---------------+---------------------+------+-----+----------------+----------------+


MediaWiki versions: 1.10 – 1.15

DESCRIBE logging;

+---------------+---------------------+------+-----+----------------+----------------+
| Field         | Type                | Null | Key | Default        | Extra          |
+---------------+---------------------+------+-----+----------------+----------------+
| log_type      | varbinary(10)       | NO   | MUL | NULL           |                |
| log_action    | varbinary(10)       | NO   |     | NULL           |                |
| log_timestamp | binary(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           |                |
| log_id        | int(10) unsigned    | NO   | PRI | NULL           | AUTO_INCREMENT |
| log_deleted   | tinyint(3) unsigned | NO   |     | 0              |                |
+---------------+---------------------+------+-----+----------------+----------------+


MediaWiki versions: 1.6 – 1.9

DESCRIBE logging;

+---------------+---------------------+------+-----+----------------+----------------+
| 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

DESCRIBE logging;

+---------------+---------------------+------+-----+----------------+----------------+
| 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

DESCRIBE logging;

+---------------+---------------------+------+-----+----------------+----------------+
| 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           |                |
+---------------+---------------------+------+-----+----------------+----------------+

See also[edit]

DatabasesManual:Database layout Engines: MySQL/MariaDBManual:MySQLOracleManual:OraclePostgreSQLManual:PostgreSQLSQLiteManual:SQLiteSQL ServerManual:Microsoft SQL Server

Technical documentation: SchemaManual:Database layout (tablesCategory:MediaWiki database tables) – API property associationsAPI:Database field and API property associationsField prefixesDatabase field prefixesPrimary key storage in other fieldsManual:Primary key storage in other fieldsWikimedia extension tablesCategory:Wikimedia extension database tables
Configuration: SettingsManual:Configuration_settings#Database_settingsSharingManual:Shared database
Development: AccessManual:Database accessOptimizationDatabase optimizationPolicyDevelopment policy#Database_patchesUpdaterManual:DatabaseUpdater.phpExtension schema updatesManual:Hooks/LoadExtensionSchemaUpdatesPatch fileManual:SQL patch file

Core tables: archivebot_passwordscategorycategorylinkschange_tagconfigexternallinksfilearchivehitcounterimageimagelinksinterwikiiwlinksipblocksjobl10n_cachelanglinkslogginglog_searchmsg_resourcemsg_resource_linksmodule_depsobjectcacheoldimagepagepagelinkspage_propspage_restrictionsprotected_titlesquerycachequerycachetwoquerycache_inforecentchangesredirectrevisionsearchindexsitessite_identifiers - site_statstag_summarytemplatelinkstexttranscacheupdateloguploadstashuseruser_former_groupsuser_groupsuser_newtalkuser_propertiestag_summaryvalid_tagwatchlist
Log actionsManual:Log actions Events: BlockingManual:Block and unblockImportingManual:Importing revisionsMerging historiesManual:Merging historiesPage deletionManual:Page deletionPage movingManual:Page movingPage restorationManual:Page restorationPatrollingManual:PatrollingProtectionManual:ProtectionRenaming a userExtension:RenameuserRevisionDeleteManual:RevisionDeleteThankingExtension:ThanksUploadingManual:UploadingUser creationManual:User creationUser rights managementManual:User rightsMerging usersManual:Merging users

Settings: $wgLogTypesManual:$wgLogTypes$wgLogActionsManual:$wgLogActions$wgLogNamesManual:$wgLogNames$wgLogHeadersManual:$wgLogHeaders$wgLogActionsHandlersManual:$wgLogActionsHandlers$wgLogRestrictionsManual:$wgLogRestrictions$wgFilterLogTypesManual:$wgFilterLogTypes$wgActionFilteredLogsManual:$wgActionFilteredLogs

Miscellaneous: Logging to Special:LogManual:Logging to Special:LogAPIAPI:Logeventslogging tableManual:Logging tableNull revisionManual:Null revision