Jump to content

User:RichMorin/mw logging

From Meta, a Wikimedia project coordination wiki

Activity logging information.


Inter-table Relationships

[edit]
  • log_namespace - page namespace ( page.page_namespace)
  • log_title - page title ( page.page_title)
  • log_user - user ID ( user.user_id)


MySQL Table Description

[edit]
mysql> desc mw_logging;
+---------------+------------------+------+-----+----------------+-------+
| Field         | Type             | Null | Key | Default        | Extra |
+---------------+------------------+------+-----+----------------+-------+
| log_type      | varchar(10)      |      | MUL |                |       |
| log_action    | varchar(10)      |      |     |                |       |
| log_timestamp | varchar(14)      |      |     | 19700101000000 |       |
| log_user      | int(10) unsigned |      | MUL | 0              |       |
| log_namespace | int(11)          |      | MUL | 0              |       |
| log_title     | varchar(255)     |      |     |                |       |
| log_comment   | varchar(255)     |      |     |                |       |
| log_params    | blob             |      |     |                |       |
+---------------+------------------+------+-----+----------------+-------+
8 rows in set


Annotated Table Creation Code

[edit]
CREATE TABLE /*$wgDBprefix*/logging (

  -- Symbolic keys for the general log type and the action type
  -- within the log. The output format will be controlled by the
  -- action field, but only the type controls categorization.

  log_type            char(10)                    NOT NULL  default '',
  log_action          char(10)                    NOT NULL  default '',
  
  -- Timestamp. Duh.

  log_timestamp       char(14)                    NOT NULL  default '19700101000000',
  
  -- The user who performed this action; key to user_id

  log_user            int            unsigned     NOT NULL  default 0,
  
  -- Key to the page affected. Where a user is the target,
  -- this will point to the user page.

  log_namespace       int                         NOT NULL  default 0,
  log_title           varchar(255)   binary       NOT NULL  default '',
  
  -- Freeform text. Interpreted as edit history comments.

  log_comment         varchar(255)                NOT NULL  default '',
  
  -- LF-separated list of miscellaneous parameters

  log_params          blob                        NOT NULL  default '',

  KEY                 type_time (log_type, log_timestamp),
  KEY                 user_time (log_user, log_timestamp),
  KEY                 page_time (log_namespace, log_title, log_timestamp)

) ENGINE=InnoDB;