API:Logevents

From MediaWiki.org
Jump to: navigation, search
Tools clipart.png This page is part of the MediaWiki action API documentation.

MediaWiki action API

v · d · e

Get a list of all logged events, à la Special:Log. This module cannot be used as a generator.

Parameters[edit]

  • leprop: Which properties to get. (Default: ids|title|type|user|timestamp|comment|details)
    • ids: Page ID of the page in question and log ID
    • title: Title of the page in question
    • type: Type of log entry
    • user: User responsible for the log entry
    • userid: The user ID who was responsible for the log event. When specified for account creation events, the userid of the creating user is returned. When absent, the userid returned is that of the created account (see bugzilla:71020).
    • timestamp: Time and date the log entry was created
    • comment: Log comment
    • parsedcomment: The parsed comment of the event
    • details: Extra information (not present for all log types)
    • tags: List tags for the event
  • letype: Only list log entries of this type. Note that extensions may add other log types.
    • block
    • delete
    • import
    • merge
    • move
    • newusers
    • patrol
    • protect
    • stable
    • rights
    • upload
  • leaction: Filter log actions to only this type. Overrides letype even if the action isn't related to letype. 1.17+
    • block/block
    • block/reblock
    • block/unblock
    • delete/delete
    • delete/event
    • delete/restore
    • delete/revision
    • import/interwiki
    • import/upload
    • merge/merge
    • move/move_redir
    • move/move
    • newusers/autocreate
    • newusers/create2
    • newusers/create
    • newusers/newusers
    • patrol/patrol
    • protect/modify
    • protect/move_prot
    • protect/protect
    • protect/unprotect
    • rights/autopromote
    • rights/erevoke
    • rights/rights
    • upload/overwrite
    • upload/revert
    • upload/upload
  • leuser: Only list log entries made by this user
  • letitle: Only list log entries related to this title
  • lestart: The timestamp to start listing from
  • leend: The timestamp to end listing at
  • ledir: Direction to list in. (Default: older)
    • older: List newest log entries first. Note: lestart has to be later than leend.
    • newer: List oldest log entries first. Note: lestart has to be earlier than leend.
  • lelimit: Maximum number of log entries to list No more than 500 (5000 for bots) allowed. (Default: 10)
  • leprefix: Filter entries that start with this prefix. Disabled in Miser Mode
  • letag: Only list event entries tagged with this tag

Example[edit]

List the 3 most recent page moves

Error Codes[edit]

Code Info
leparam_user User name username not found
leparam_title Bad title value 'title'
This happens when you set letitle to an invalid title.




list=logevents (le)

(main | query | logevents)
  • This module requires read rights.
  • Source: MediaWiki
  • License: GPL-2.0+

Get events from logs.

Parameters:
leprop

Which properties to get:

ids

Adds the ID of the log event.
title
Adds the title of the page for the log event.
type
Adds the type of log event.
user
Adds the user responsible for the log event.
userid
Adds the user ID who was responsible for the log event.
timestamp
Adds the timestamp for the log event.
comment
Adds the comment of the log event.
parsedcomment
Adds the parsed comment of the log event.
details
Lists additional details about the log event.
tags

Lists tags for the log event.
Values (separate with | or alternative): ids, title, type, user, userid, timestamp, comment, parsedcomment, details, tags
Default: ids|title|type|user|timestamp|comment|details
letype

Filter log entries to only this type.

One of the following values: Can be empty, or spamblacklist, titleblacklist, gblblock, renameuser, globalauth, gblrights, gblrename, abusefilter, liquidthreads, massmessage, notifytranslators, thanks, usermerge, newsletter, block, protect, rights, delete, upload, move, import, patrol, merge, suppress, tag, managetags, contentmodel, timedmediahandler, translationreview, newusers, pagelang, pagetranslation
leaction

Filter log actions to only this action. Overrides letype. In the list of possible values, values with the asterisk wildcard such as action/* can have different strings after the slash (/).

One of the following values: gblblock/gblock, gblblock/gblock2, gblblock/gunblock, gblblock/modify, globalauth/delete, globalauth/lock, globalauth/unlock, globalauth/hide, globalauth/unhide, globalauth/lockandhid, globalauth/setstatus, suppress/setstatus, suppress/cadelete, gblrights/usergroups, gblrights/groupperms, gblrights/groupprms2, gblrights/groupprms3, suppress/hide-afl, suppress/unhide-afl, usermerge/mergeuser, usermerge/deleteuser, spamblacklist/*, titleblacklist/*, gblblock/whitelist, gblblock/dwhitelist, renameuser/renameuser, gblrights/grouprename, gblrename/rename, gblrename/promote, gblrename/merge, gblrights/newset, gblrights/setrename, gblrights/setnewtype, gblrights/setchange, gblrights/deleteset, abusefilter/hit, abusefilter/modify, liquidthreads/move, liquidthreads/split, liquidthreads/merge, liquidthreads/subjectedit, liquidthreads/resort, liquidthreads/signatureedit, massmessage/*, massmessage/send, massmessage/failure, massmessage/skipoptout, massmessage/skipnouser, massmessage/skipbadns, notifytranslators/sent, thanks/*, delete/flow-restore-post, suppress/flow-restore-post, delete/flow-restore-topic, suppress/flow-restore-topic, lock/flow-restore-topic, import/lqt-to-flow-topic, newsletter/*, block/block, block/reblock, block/unblock, contentmodel/change, contentmodel/new, delete/delete, delete/delete_redir, delete/event, delete/restore, delete/revision, import/interwiki, import/upload, managetags/activate, managetags/create, managetags/deactivate, managetags/delete, merge/merge, move/move, move/move_redir, patrol/patrol, patrol/autopatrol, protect/modify, protect/move_prot, protect/protect, protect/unprotect, rights/autopromote, rights/rights, suppress/block, suppress/delete, suppress/event, suppress/reblock, suppress/revision, tag/update, upload/overwrite, upload/revert, upload/upload, timedmediahandler/resettranscode, translationreview/message, translationreview/group, delete/flow-delete-post, delete/flow-delete-topic, suppress/flow-suppress-post, suppress/flow-suppress-topic, lock/flow-lock-topic, newusers/newusers, newusers/create, newusers/create2, newusers/byemail, newusers/autocreate, pagelang/pagelang, pagetranslation/mark, pagetranslation/unmark, pagetranslation/moveok, pagetranslation/movenok, pagetranslation/deletelok, pagetranslation/deletefok, pagetranslation/deletelnok, pagetranslation/deletefnok, pagetranslation/encourage, pagetranslation/discourage, pagetranslation/prioritylanguages, pagetranslation/associate, pagetranslation/dissociate
lestart

The timestamp to start enumerating from.

Type: timestamp (allowed formats)
leend

The timestamp to end enumerating.

Type: timestamp (allowed formats)
ledir

In which direction to enumerate:

newer
List oldest first. Note: lestart has to be before leend.
older
List newest first (default). Note: lestart has to be later than leend.
One of the following values: newer, older
Default: older
leuser

Filter entries to those made by the given user.

Type: user name
letitle

Filter entries to those related to a page.

lenamespace

Filter entries to those in the given namespace.

One of the following values: -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92, 93, 100, 101, 102, 103, 104, 105, 106, 107, 486, 487, 828, 829, 1198, 1199, 2300, 2301, 2302, 2303, 2600, 5500, 5501
leprefix

Disabled due to miser mode.

letag

Only list event entries tagged with this tag.

lelimit

How many total event entries to return.

No more than 500 (5,000 for bots) allowed.
Type: integer or max
Default: 10
lecontinue

When more results are available, use this to continue.

Notes[edit]

For autoblock unblock entries, the page title is shown as "User:$blockid". This is indeed not a User page, just the way it is stored. As per task T19781

Results[edit]

It returns a list of items, each item being a log item.

Items can contain these properties, from the logging table:

  • logid: Content of the log_id field.
  • ns: Content of the log_namespace field.
  • title: Prefixed title from the log_namespace and log_title fields.
  • pageid: Page id corresponding to the current page defined by the combination of the log_namespace and log_title fields. It represents the current page id, not the page id at the time the log was stored.
  • logpage: Content of the log_page field. It represents the page id at the time the log was stored.
  • type: Content of the log_type field.
  • action: Content of the log_action field.
  • userid: Content of the log_user field.
  • user: Content of the log_user_text field.
  • timestamp: Content of the log_timestamp field formatted in ISO 8601 format.
  • comment: Content of the log_comment field.
  • actionhidden: Boolean indicating the title was hidden. ns and title will be absent if the user has no sufficient rights to view deleted log entries.
  • commenthidden: Boolean indicating the comment was hidden. comment will be absent if the user has no sufficient rights to view deleted log entries.
  • userhidden: Boolean indicating the user was hidden. user and userid will be absent if the user has no sufficient rights to view deleted log entries.
  • suppressed: Boolean indicating details were supressed. Only users with the suppressrevision can view them.
  • params: Prettified content of the log_params field in array format:
    • Legacy parameters will contain numeric keys, where each key is a line.
    • Other entries are formatted according to the LogFormatter class:
      • In general, parameter names in "4::paramname" format are output as "paramname", stripping the index and type and formatting the value accordingly.
      • If the parameter is a title, it's split in 2 parameters: paramname_ns (contains the namespace number) and paramname_title (contains the whole title, namespace included).
    • Before MediaWiki 1.25:
      • Parameters weren't in the params property, but in a property with the same name as the type value.
      • Some log types had different parameter names.
      • Legacy parameters were in numeric keys directly inside the log entry and not inside the params property.

Here are some examples of child elements that reveal log parameters:

Block

<block duration="3 days" expiry="2014-09-18T20:35:54Z"><flags><f>nocreate</f></flags></params>

Move

<move target_ns="0" target_title="Foo" suppressredirect="" />

Patrol

<params curid="12" previd="0" auto="1" />

Rights

<params><newgroups><g>sysop</g></newgroups><oldgroups /></params>

See also[edit]

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
Language:Project:Language policy English  • polski