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: 14:18, 25 June 2008 Jacksprat (Talk | contribs| block) uploaded "Image:Climb.jpg" (Added this image for the climbing page)

log_id

 * log_id: primary key for the table. rc_logid is a foreign key linking to this.

log_type

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

log_action
mysql> SELECT DISTINCT log_action FROM logging; ++ ++ ++ 26 rows in set
 * 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. Values are (as of 19 June 2009; the list of possible  values at API:Logevents suggests that this list may have greatly expanded):
 * log_action |
 * upload    |
 * delete    |
 * protect   |
 * unprotect |
 * restore   |
 * rights    |
 * block     |
 * move      |
 * move_redir |
 * newusers  |
 * unblock   |
 * create    |
 * create2   |
 * renameuser |
 * grant     |
 * revoke    |
 * modify    |
 * overwrite |
 * patrol    |
 * autocreate |
 * move_prot |
 * reblock   |
 * event     |
 * revision  |
 * whitelist |
 * dwhitelist |

log_timestamp
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
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
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
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
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
log_page: The page_id that this log action is about. Comparable to rc_cur_id and rev_page.

log_comment
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
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.

log_deleted
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.19:

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