Manual: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:

log_id
Primary key for the table. rc_logid is a foreign key linking to this.

log_type
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_type. Values on enwiki, as of 23 July 2014, are: MariaDB [enwiki_p]> SELECT DISTINCT log_type FROM logging; +-+ +-+ +-+ 33 rows in set (0.01 sec)
 * log_type           |
 * abusefilter        |
 * articlefeedbackv5  |
 * block              |
 * campus             |
 * close              |
 * course             |
 * delete             |
 * eparticle          |
 * gblblock           |
 * gblrights          |
 * globalauth         |
 * import             |
 * institution        |
 * instructor         |
 * massmessage        |
 * merge              |
 * moodbar            |
 * move               |
 * newusers           |
 * online             |
 * pagetriage-curation |
 * pagetriage-deletion |
 * patrol             |
 * protect            |
 * renameuser         |
 * review             |
 * rights             |
 * spamblacklist      |
 * stable             |
 * student            |
 * thanks             |
 * upload             |
 * upload             |

log_action
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_action. See also API:Logevents. Values on enwiki are (as of 23 July 2014): MariaDB [enwiki_p]> SELECT DISTINCT log_action FROM logging; ++ ++ ++ 85 rows in set (50.23 sec)
 * log_action        |
 * delete            |
 * upload            |
 * protect           |
 * block             |
 * unblock           |
 * restore           |
 * unprotect         |
 * rights            |
 * NULL              |
 * move              |
 * move_redir        |
 * renameuser        |
 * newusers          |
 * create            |
 * create2           |
 * modify            |
 * overwrite         |
 * patrol            |
 * autocreate        |
 * whitelist         |
 * dwhitelist        |
 * move_prot         |
 * reblock           |
 * event             |
 * revision          |
 * usergroups        |
 * interwiki         |
 * groupprms2        |
 * config            |
 * approve-ia        |
 * approve-a         |
 * unapprove         |
 * approve           |
 * reset             |
 * approve-i         |
 * setstatus         |
 * hide              |
 * feedback          |
 * flag              |
 * unflag            |
 * unhide            |
 * autohide          |
 * feature           |
 * resolve           |
 * autoflag          |
 * unresolve         |
 * unfeature         |
 * helpful           |
 * undo-helpful      |
 * unhelpful         |
 * undo-unhelpful    |
 * clear-flags       |
 * reviewed          |
 * tag               |
 * unreviewed        |
 * add               |
 * profilesave       |
 * update            |
 * selfadd           |
 * selfremove        |
 * remove            |
 * review            |
 * unreview          |
 * undelete          |
 * byemail           |
 * noaction          |
 * inappropriate     |
 * unnoaction        |
 * uninappropriate   |
 * thank             |
 * archive           |
 * unarchive         |
 * hit               |
 * send              |
 * skipbadns         |
 * skipnouser        |
 * skipoptout        |
 * failure           |
 * flow-delete-topic |
 * flow-delete-post  |
 * flow-restore-topic |
 * flow-close-topic  |
 * flow-restore-post |
 * merge             |
 * merge             |

MariaDB [enwiki_p]> SELECT DISTINCT log_type, log_action FROM logging ORDER BY log_type; +-++ +-++ +-++ 131 rows in set (58.74 sec)
 * log_type           | log_action         |
 * abusefilter        | modify             |
 * articlefeedbackv5  | archive            |
 * articlefeedbackv5  | autoflag           |
 * articlefeedbackv5  | autohide           |
 * articlefeedbackv5  | clear-flags        |
 * articlefeedbackv5  | create             |
 * articlefeedbackv5  | feature            |
 * articlefeedbackv5  | flag               |
 * articlefeedbackv5  | helpful            |
 * articlefeedbackv5  | hide               |
 * articlefeedbackv5  | inappropriate      |
 * articlefeedbackv5  | noaction           |
 * articlefeedbackv5  | protect            |
 * articlefeedbackv5  | resolve            |
 * articlefeedbackv5  | unarchive          |
 * articlefeedbackv5  | undo-helpful       |
 * articlefeedbackv5  | undo-unhelpful     |
 * articlefeedbackv5  | unfeature          |
 * articlefeedbackv5  | unflag             |
 * articlefeedbackv5  | unhelpful          |
 * articlefeedbackv5  | unhide             |
 * articlefeedbackv5  | uninappropriate    |
 * articlefeedbackv5  | unnoaction         |
 * articlefeedbackv5  | unresolve          |
 * block              | NULL               |
 * block              | block              |
 * block              | reblock            |
 * block              | unblock            |
 * campus             | add                |
 * campus             | profilesave        |
 * campus             | remove             |
 * campus             | selfadd            |
 * campus             | selfremove         |
 * close              | flow-close-topic   |
 * close              | flow-restore-topic |
 * course             | add                |
 * course             | remove             |
 * course             | undelete           |
 * course             | update             |
 * delete             | NULL               |
 * delete             | delete             |
 * delete             | event              |
 * delete             | flow-delete-post   |
 * delete             | flow-delete-topic  |
 * delete             | flow-restore-post  |
 * delete             | flow-restore-topic |
 * delete             | restore            |
 * delete             | revision           |
 * eparticle          | add                |
 * eparticle          | remove             |
 * eparticle          | review             |
 * eparticle          | selfadd            |
 * eparticle          | selfremove         |
 * eparticle          | unreview           |
 * gblblock           | dwhitelist         |
 * gblblock           | whitelist          |
 * gblrights          | groupprms2         |
 * gblrights          | usergroups         |
 * globalauth         | delete             |
 * globalauth         | setstatus          |
 * import             | interwiki          |
 * import             | upload             |
 * institution        | add                |
 * institution        | remove             |
 * institution        | update             |
 * instructor         | add                |
 * instructor         | remove             |
 * instructor         | selfadd            |
 * instructor         | selfremove         |
 * massmessage        | failure            |
 * massmessage        | send               |
 * massmessage        | skipbadns          |
 * massmessage        | skipnouser         |
 * massmessage        | skipoptout         |
 * merge              | merge              |
 * moodbar            | NULL               |
 * moodbar            | delete             |
 * moodbar            | feedback           |
 * moodbar            | hide               |
 * moodbar            | restore            |
 * move               | NULL               |
 * move               | move               |
 * move               | move_redir         |
 * newusers           | NULL               |
 * newusers           | autocreate         |
 * newusers           | byemail            |
 * newusers           | create             |
 * newusers           | create2            |
 * newusers           | newusers           |
 * online             | add                |
 * online             | profilesave        |
 * online             | selfadd            |
 * online             | selfremove         |
 * pagetriage-curation | NULL              |
 * pagetriage-curation | delete            |
 * pagetriage-curation | reviewed          |
 * pagetriage-curation | tag               |
 * pagetriage-curation | unreviewed        |
 * pagetriage-deletion | NULL              |
 * pagetriage-deletion | delete            |
 * patrol             | NULL               |
 * patrol             | patrol             |
 * protect            | NULL               |
 * protect            | modify             |
 * protect            | move_prot          |
 * protect            | protect            |
 * protect            | unprotect          |
 * renameuser         | NULL               |
 * renameuser         | renameuser         |
 * review             | approve            |
 * review             | approve-a          |
 * review             | approve-i          |
 * review             | approve-ia         |
 * review             | unapprove          |
 * rights             | NULL               |
 * rights             | rights             |
 * spamblacklist      | hit                |
 * stable             | config             |
 * stable             | modify             |
 * stable             | reset              |
 * student            | NULL               |
 * student            | add                |
 * student            | remove             |
 * student            | selfadd            |
 * student            | selfremove         |
 * thanks             | NULL               |
 * thanks             | thank              |
 * upload             | NULL               |
 * upload             | overwrite          |
 * upload             | upload             |
 * upload             | upload             |

log_timestamp
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_timestamp and rev_timestamp.

log_user
The id of the user who performed the action. This is a reference into the user table (the user id of "Jacksprat" in example). Comparable to rc_user and rev_user.

log_user_text
username of the user who performed the action, intended primarily for anonymous users, fillable by maintenance/populateLogUsertext.php. Comparable to rc_user_text and rev_user_text.

log_namespace
The namespace of the affected page. Together with log_title, this is a reference into the page table ("Image:Climb.jpg" in example). Comparable to rc_namespace.
 * Note: 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 and log_action being "newusers"

log_title
The title of the affected page. Together with log_namespace, this is a reference into the page table. Comparable to rc_title.

log_page
The page_id that this log action is about. Comparable to rc_cur_id and rev_page. In the case of a page move, this is set to the page_id of the redirect. If the page was moved without creating a redirect, then it is set to 0.

log_comment
The comment given for the action; that is the upload comment for uploads, the deletion comment for deletions, etc. Comparable to rc_comment and rev_comment.

log_params
Additional parameters, usually empty. For user blocks, this contains the duration of the block and other data, in human readable form, e.g. "2 weeks nocreate,noautoblock,noemail". For page moves, this contains a serialized array of the page title the page was moved to (in FULLPAGENAME format) and the boolean value of. Mirrored in rc_params.

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%'

Since 1.21, log_params is always serialised for newusers log too. An entry now looks like: mysql> select log_params, log_action from logging where log_user = 4681690; +--++ +--++ +--++ while it used to look like: mysql> select log_params, log_action from logging where log_user = 2298743; +++ +++ +++
 * log_params                      | log_action |
 * a:1:{s:9:"4::userid";i:4681690;} | autocreate |
 * 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,...)

log_deleted
Used with the revision delete system to delete log entries. This field is comparable to rc_deleted and 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
DESCRIBE logging; yields the following in MW 1.22:

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

DESCRIBE logging; yields the following in MW 1.19-1.20:

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

DESCRIBE logging; yields the following in MW 1.17:

+---+-+--+-+++ +---+-+--+-+++ +---+-+--+-+++
 * Field        | Type                | Null | Key | Default        | Extra          |
 * log_id       | int(10) unsigned    | NO   | PRI |                | 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 | varchar(255)       | NO   |     |                |                |
 * log_namespace | int(11)            | NO   | MUL | 0              |                |
 * log_title    | varchar(255)        | NO   |     |                |                |
 * log_page     | int(10) unsigned    | YES  | MUL | NULL           |                |
 * log_comment  | varchar(255)        | NO   |     |                |                |
 * log_params   | blob                | NO   |     |                |                |
 * log_deleted  | tinyint(3) unsigned | NO   |     | 0              |                |

+---+-+--+-+++ +---+-+--+-+++ +---+-+--+-+++
 * 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 | varbinary(14)      | NO   | MUL | 19700101000000 |                |
 * log_user     | int(10) unsigned    | NO   | MUL | 0              |                |
 * log_namespace | int(11)            | NO   | MUL | NULL           |                |
 * log_title    | varbinary(255)      | NO   |     |                |                |
 * log_comment  | varbinary(255)      | NO   |     |                |                |
 * log_params   | blob                | NO   |     | NULL           |                |
 * log_deleted  | tinyint(3) unsigned | NO   |     | 0              |                |
 * log_user_text | varbinary(255)     | NO   |     |                |                |
 * log_page     | int(10) unsigned    | YES  | MUL | NULL           |                |

+---+--+--+-+++ +---+--+--+-+++ +---+--+--+-+++
 * Field        | Type             | Null | Key | Default        | Extra          |
 * log_type     | varbinary(10)    | NO   | MUL |                |                |
 * log_action   | varbinary(10)    | NO   |     |                |                |
 * log_timestamp | binary(14)      | NO   | MUL | 19700101000000 |                |
 * log_user     | int unsigned     | NO   | MUL | 0              |                |
 * log_namespace | int(11)         | NO   | MUL | 0              |                |
 * log_title    | varchar(255)     | NO   |     |                |                |
 * log_comment  | varchar(255)     | NO   |     |                |                |
 * log_params   | blob             | NO   |     |                |                |
 * log_deleted  | tinyint unsigned | NO   |     | 0              |                |
 * log_id       | int unsigned     | NO   | PRI |                | auto_increment |

+---+--+--+-+++ +---+--+--+-+++ +---+--+--+-+++
 * Field        | Type             | Null | Key | Default        | Extra          |
 * log_type     | char(10)         | NO   | MUL |                |                |
 * log_action   | char(10)         | NO   |     |                |                |
 * log_timestamp | char(14)        | NO   | MUL | 19700101000000 |                |
 * log_user     | int unsigned     | NO   | MUL | 0              |                |
 * log_namespace | int(11)         | NO   | MUL | 0              |                |
 * log_title    | varchar(255)     | NO   |     |                |                |
 * log_comment  | varchar(255)     | NO   |     |                |                |
 * log_params   | blob             | NO   |     |                |                |

+---+--+--+-+++ +---+--+--+-+++ +---+--+--+-+++
 * Field        | Type             | Null | Key | Default        | Extra          |
 * log_type     | char(10)         | NO   | MUL |                |                |
 * log_action   | char(10)         | NO   |     |                |                |
 * log_timestamp | char(14)        | NO   |     | 19700101000000 |                |
 * log_user     | int unsigned     | NO   | MUL | 0              |                |
 * log_namespace | int(11)         | NO   | MUL | 0              |                |
 * log_title    | varchar(255)     | NO   |     |                |                |
 * log_comment  | varchar(255)     | NO   |     |                |                |
 * log_params   | blob             | NO   |     |                |                |