Page MenuHomePhabricator

MediaWiki-Debug-LoggerComponent
ActivePublic

Members (3)

Watchers

  • This project does not have any watchers.
  • View All

Details

Description

Issues related to MediaWiki core's PSR debug logger, stats and timing services, and their configuration.

This includes:

  • PSR-3 logging: The MediaWiki\Logger namespace of classes (such as Spi and Monolog integration), and their utility functions such as wfDebugLog(), and configuration such as $wgDebugLogFile and $wgDebugLogGroups.
  • The debug toolbar.
  • The StatsdDataFactory service and its wiring.
  • The Timing class as used via RequestContext::getTiming.

For the debug profiler, refer to MediaWiki-Core-Profiler.
For the Metrics library (replacing StatsdDataFactory), refer to MediaWiki-libs-Stats.
For the shell.php and eval.php debugging tools, use the Shell & Eval column of MediaWiki-Maintenance-system.
For WMF's production infrastructure, refer to Wikimedia-Logstash.
To report production errors, use Wikimedia-production-error.

Recent Activity

Mon, Jun 9

matmarex closed T395967: Allow sampling of Logstash events as Resolved.

Works as expected. This is the effect on authevents logs:

image.png (184×1 px, 18 KB)
Mon, Jun 9, 1:36 PM · MediaWiki-Platform-Team, MediaWiki-Debug-Logger, Observability-Logging, Wikimedia-Logstash
Stashbot added a comment to T395967: Allow sampling of Logstash events.

Mentioned in SAL (#wikimedia-operations) [2025-06-09T13:31:29Z] <taavi@deploy1003> Finished scap sync-world: Backport for [[gerrit:1153363|logging: Allow sampling of Logstash logs (T395967)]], [[gerrit:1153364|logging: Sample some high-volume log streams (T394402)]] (duration: 24m 30s)

Mon, Jun 9, 1:31 PM · MediaWiki-Platform-Team, MediaWiki-Debug-Logger, Observability-Logging, Wikimedia-Logstash
Maintenance_bot removed a project from T395967: Allow sampling of Logstash events: Patch-For-Review.
Mon, Jun 9, 1:30 PM · MediaWiki-Platform-Team, MediaWiki-Debug-Logger, Observability-Logging, Wikimedia-Logstash
Stashbot added a comment to T395967: Allow sampling of Logstash events.

Mentioned in SAL (#wikimedia-operations) [2025-06-09T13:21:13Z] <taavi@deploy1003> taavi, tgr: Backport for [[gerrit:1153363|logging: Allow sampling of Logstash logs (T395967)]], [[gerrit:1153364|logging: Sample some high-volume log streams (T394402)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mon, Jun 9, 1:21 PM · MediaWiki-Platform-Team, MediaWiki-Debug-Logger, Observability-Logging, Wikimedia-Logstash
Stashbot added a comment to T395967: Allow sampling of Logstash events.

Mentioned in SAL (#wikimedia-operations) [2025-06-09T13:06:59Z] <taavi@deploy1003> Started scap sync-world: Backport for [[gerrit:1153363|logging: Allow sampling of Logstash logs (T395967)]], [[gerrit:1153364|logging: Sample some high-volume log streams (T394402)]]

Mon, Jun 9, 1:07 PM · MediaWiki-Platform-Team, MediaWiki-Debug-Logger, Observability-Logging, Wikimedia-Logstash
gerritbot added a comment to T395967: Allow sampling of Logstash events.

Change #1153363 merged by jenkins-bot:

[operations/mediawiki-config@master] logging: Allow sampling of Logstash logs

https://gerrit.wikimedia.org/r/1153363

Mon, Jun 9, 1:06 PM · MediaWiki-Platform-Team, MediaWiki-Debug-Logger, Observability-Logging, Wikimedia-Logstash

Thu, Jun 5

Tgr claimed T395967: Allow sampling of Logstash events.
Thu, Jun 5, 12:44 PM · MediaWiki-Platform-Team, MediaWiki-Debug-Logger, Observability-Logging, Wikimedia-Logstash
Tgr added a comment to T395967: Allow sampling of Logstash events.

Also, with sampling you can see changes in total volume. Without it, it just maxes out at 100/sec and to see if a code change affected the log volume you need filter on pseudo-random subsets (like an arbitrary wiki or user agent) which is a hassle and somewhat unreliable.

Thu, Jun 5, 10:04 AM · MediaWiki-Platform-Team, MediaWiki-Debug-Logger, Observability-Logging, Wikimedia-Logstash
matmarex added a parent task for T395967: Allow sampling of Logstash events: T394402: Reduce noisy auth logs.
Thu, Jun 5, 1:37 AM · MediaWiki-Platform-Team, MediaWiki-Debug-Logger, Observability-Logging, Wikimedia-Logstash
matmarex moved T395204: MediaWiki should log request information (IP, user agent, referrer, HTTP method, etc) in a more uniform and predictable way from Inbox, needs triage to In progress on the MediaWiki-Platform-Team board.
Thu, Jun 5, 1:30 AM · MediaWiki-Platform-Team, Patch-For-Review, MediaWiki-User-login-and-signup, MediaWiki-Debug-Logger, Security
matmarex moved T395967: Allow sampling of Logstash events from Inbox, needs triage to In progress on the MediaWiki-Platform-Team board.
Thu, Jun 5, 1:30 AM · MediaWiki-Platform-Team, MediaWiki-Debug-Logger, Observability-Logging, Wikimedia-Logstash

Wed, Jun 4

Krinkle added a comment to T395967: Allow sampling of Logstash events.

Thanks, that makes sense!

Wed, Jun 4, 10:27 PM · MediaWiki-Platform-Team, MediaWiki-Debug-Logger, Observability-Logging, Wikimedia-Logstash
Tgr added a comment to T395967: Allow sampling of Logstash events.

Can you say more explicitly what the intended gain is?

Wed, Jun 4, 8:50 PM · MediaWiki-Platform-Team, MediaWiki-Debug-Logger, Observability-Logging, Wikimedia-Logstash
Krinkle added a comment to T395967: Allow sampling of Logstash events.

Sampling would be a step up from the much less controllable throttling mechanism of T395899, so we should fix that.

Wed, Jun 4, 7:44 PM · MediaWiki-Platform-Team, MediaWiki-Debug-Logger, Observability-Logging, Wikimedia-Logstash
gerritbot added a comment to T395204: MediaWiki should log request information (IP, user agent, referrer, HTTP method, etc) in a more uniform and predictable way.

Change #1153626 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[operations/mediawiki-config@master] Use GetSecurityLogContext hook for goodpass/badpass logging

https://gerrit.wikimedia.org/r/1153626

Wed, Jun 4, 1:29 PM · MediaWiki-Platform-Team, Patch-For-Review, MediaWiki-User-login-and-signup, MediaWiki-Debug-Logger, Security
gerritbot added a comment to T395204: MediaWiki should log request information (IP, user agent, referrer, HTTP method, etc) in a more uniform and predictable way.

Change #1153618 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[mediawiki/extensions/CentralAuth@master] Add global existence info on GetSecurityLogContext hook

https://gerrit.wikimedia.org/r/1153618

Wed, Jun 4, 1:00 PM · MediaWiki-Platform-Team, Patch-For-Review, MediaWiki-User-login-and-signup, MediaWiki-Debug-Logger, Security
Tgr claimed T395204: MediaWiki should log request information (IP, user agent, referrer, HTTP method, etc) in a more uniform and predictable way.
Wed, Jun 4, 10:12 AM · MediaWiki-Platform-Team, Patch-For-Review, MediaWiki-User-login-and-signup, MediaWiki-Debug-Logger, Security

Tue, Jun 3

gerritbot added a project to T395967: Allow sampling of Logstash events: Patch-For-Review.
Tue, Jun 3, 9:13 PM · MediaWiki-Platform-Team, MediaWiki-Debug-Logger, Observability-Logging, Wikimedia-Logstash
gerritbot added a comment to T395967: Allow sampling of Logstash events.

Change #1153363 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[operations/mediawiki-config@master] logging: Allow sampling of Logstash logs

https://gerrit.wikimedia.org/r/1153363

Tue, Jun 3, 9:13 PM · MediaWiki-Platform-Team, MediaWiki-Debug-Logger, Observability-Logging, Wikimedia-Logstash
Tgr closed T395899: Some subset of MediaWiki Logstash events are capped to 100/s as Resolved.

@Krinkle found the config file where this is set up. I added some docs and filed T395967: Allow sampling of Logstash events about handling high-volume event streams in a better way; I think this can be closed.

Tue, Jun 3, 8:56 PM · Observability-Logging, MediaWiki-Debug-Logger, Documentation, Wikimedia-Logstash
Krinkle added a comment to T395899: Some subset of MediaWiki Logstash events are capped to 100/s.
@Tgr wrote in the **task description*:

seems to be based on the normalized_message field?

Tue, Jun 3, 8:55 PM · Observability-Logging, MediaWiki-Debug-Logger, Documentation, Wikimedia-Logstash
Tgr created T395967: Allow sampling of Logstash events.
Tue, Jun 3, 8:54 PM · MediaWiki-Platform-Team, MediaWiki-Debug-Logger, Observability-Logging, Wikimedia-Logstash
Krinkle added a comment to T395899: Some subset of MediaWiki Logstash events are capped to 100/s.
@Tgr wrote in the task description:

[…] exactly 90K events in 15 minutes (ie. 100/sec) but distributed in an uneven, sawtooth pattern of exactly 15K events in a roughly 1-minute window and then zero events for a slightly less than 1-minute or 2-minute interval (those two lengths seem to be alternating).
So maybe a combination of a 15K/60s cap and a 30K/300s cap? […]

Tue, Jun 3, 8:39 PM · Observability-Logging, MediaWiki-Debug-Logger, Documentation, Wikimedia-Logstash
Krinkle added a project to T395899: Some subset of MediaWiki Logstash events are capped to 100/s: Observability-Logging.
Tue, Jun 3, 8:21 PM · Observability-Logging, MediaWiki-Debug-Logger, Documentation, Wikimedia-Logstash
Tgr added a comment to T395899: Some subset of MediaWiki Logstash events are capped to 100/s.

A negative side effect of this is that the mwdebug Logstash dashboard becomes unreliable. It would be nice to exempt debug hosts from the cap, they don't have much log volume.

Tue, Jun 3, 1:19 PM · Observability-Logging, MediaWiki-Debug-Logger, Documentation, Wikimedia-Logstash
Tgr updated the task description for T395899: Some subset of MediaWiki Logstash events are capped to 100/s.
Tue, Jun 3, 1:17 PM · Observability-Logging, MediaWiki-Debug-Logger, Documentation, Wikimedia-Logstash
Tgr added a comment to T395899: Some subset of MediaWiki Logstash events are capped to 100/s.

A check for normalized_message:"Central autologin attempt" in udp2log files:

tgr@mwlog1002:/srv/mw-log$ ack '^2025-06-03 00:20:' authevents.log > ~/authevents-2025-06-03-00-20.txt
tgr@mwlog1002:/srv/mw-log$ ack 'Central autologin attempt' ~/authevents-2025-06-03-00-20.txt | wc -l
44659

so that's about 800/sec. (And a massive waste of disk space - authevents really shouldn't be recorded at all. True for some other log channels as well, like poolcounter or xff.)

Tue, Jun 3, 1:10 PM · Observability-Logging, MediaWiki-Debug-Logger, Documentation, Wikimedia-Logstash
Tgr added a comment to T395899: Some subset of MediaWiki Logstash events are capped to 100/s.

I skimmed codesearch results for 100/6000/30000 but did not see anything relevant. The rsyslog config has RateLimit.Burst=100 for MediaWiki but that doesn't really match the behavior.

Tue, Jun 3, 1:05 PM · Observability-Logging, MediaWiki-Debug-Logger, Documentation, Wikimedia-Logstash
Tgr updated the task description for T395899: Some subset of MediaWiki Logstash events are capped to 100/s.
Tue, Jun 3, 1:00 PM · Observability-Logging, MediaWiki-Debug-Logger, Documentation, Wikimedia-Logstash
Tgr created T395899: Some subset of MediaWiki Logstash events are capped to 100/s.
Tue, Jun 3, 12:58 PM · Observability-Logging, MediaWiki-Debug-Logger, Documentation, Wikimedia-Logstash

Thu, May 29

Krinkle renamed T341815: Logstash dashboard mediawiki-errors lacks "error"-level messages from diagnostic channels from Kibana dashboard mediawiki-errors lacks channel errors and exceptions to Logstash dashboard mediawiki-errors lacks "error"-level messages from diagnostic channels.
Thu, May 29, 5:01 PM · MediaWiki-Platform-Team (Radar), Developer Productivity, MediaWiki-Debug-Logger, Release-Engineering-Team, Wikimedia-Logstash
Krinkle added projects to T341815: Logstash dashboard mediawiki-errors lacks "error"-level messages from diagnostic channels: Developer Productivity, MediaWiki-Platform-Team (Radar).
Thu, May 29, 4:29 PM · MediaWiki-Platform-Team (Radar), Developer Productivity, MediaWiki-Debug-Logger, Release-Engineering-Team, Wikimedia-Logstash
Krinkle added a project to T341815: Logstash dashboard mediawiki-errors lacks "error"-level messages from diagnostic channels: MediaWiki-Debug-Logger.

This is intentional. The way it is meant to work is that uncaught errors or errors that otherwise means the request/process did not succeed in what it wanted to do (i.e. relevant operationally in terms of service health), that those go to the error channel.

Thu, May 29, 4:29 PM · MediaWiki-Platform-Team (Radar), Developer Productivity, MediaWiki-Debug-Logger, Release-Engineering-Team, Wikimedia-Logstash

Wed, May 28

Tgr added a comment to T395204: MediaWiki should log request information (IP, user agent, referrer, HTTP method, etc) in a more uniform and predictable way.

We should also log whether the central and local account exists.

Wed, May 28, 3:58 PM · MediaWiki-Platform-Team, Patch-For-Review, MediaWiki-User-login-and-signup, MediaWiki-Debug-Logger, Security

Mon, May 26

gerritbot added a comment to T395204: MediaWiki should log request information (IP, user agent, referrer, HTTP method, etc) in a more uniform and predictable way.

Change #1150677 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[mediawiki/core@master] [WIP] Unify logging of IP / user agent / etc on sensitive operations

https://gerrit.wikimedia.org/r/1150677

Mon, May 26, 1:08 PM · MediaWiki-Platform-Team, Patch-For-Review, MediaWiki-User-login-and-signup, MediaWiki-Debug-Logger, Security
kostajh renamed T395204: MediaWiki should log request information (IP, user agent, referrer, HTTP method, etc) in a more uniform and predictable way from MediaWiki should log request information (IP, user agent ) in a more uniform and predictable way to MediaWiki should log request information (IP, user agent, referrer, HTTP method, etc) in a more uniform and predictable way.
Mon, May 26, 11:15 AM · MediaWiki-Platform-Team, Patch-For-Review, MediaWiki-User-login-and-signup, MediaWiki-Debug-Logger, Security
kostajh renamed T395204: MediaWiki should log request information (IP, user agent, referrer, HTTP method, etc) in a more uniform and predictable way from MediaWiki should log request information (IP etc) in a more uniform and predictable way to MediaWiki should log request information (IP, user agent ) in a more uniform and predictable way.
Mon, May 26, 11:15 AM · MediaWiki-Platform-Team, Patch-For-Review, MediaWiki-User-login-and-signup, MediaWiki-Debug-Logger, Security
gerritbot added a project to T395204: MediaWiki should log request information (IP, user agent, referrer, HTTP method, etc) in a more uniform and predictable way: Patch-For-Review.
Mon, May 26, 11:13 AM · MediaWiki-Platform-Team, Patch-For-Review, MediaWiki-User-login-and-signup, MediaWiki-Debug-Logger, Security
gerritbot added a comment to T395204: MediaWiki should log request information (IP, user agent, referrer, HTTP method, etc) in a more uniform and predictable way.

Change #1130543 had a related patch set uploaded (by Kosta Harlan; author: Máté Szabó):

[mediawiki/core@master] logger: Add client IP to logger context

https://gerrit.wikimedia.org/r/1130543

Mon, May 26, 11:13 AM · MediaWiki-Platform-Team, Patch-For-Review, MediaWiki-User-login-and-signup, MediaWiki-Debug-Logger, Security
kostajh added a comment to T395204: MediaWiki should log request information (IP, user agent, referrer, HTTP method, etc) in a more uniform and predictable way.

https://doc.wikimedia.org/ecs/ contains a spec for most of these fields (xff and geocookie are not in ECS), so I think we could follow the ECS guidance for these.

Mon, May 26, 9:58 AM · MediaWiki-Platform-Team, Patch-For-Review, MediaWiki-User-login-and-signup, MediaWiki-Debug-Logger, Security

Sun, May 25

kostajh added a comment to T395204: MediaWiki should log request information (IP, user agent, referrer, HTTP method, etc) in a more uniform and predictable way.

See also this patch: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1130543

Sun, May 25, 6:06 PM · MediaWiki-Platform-Team, Patch-For-Review, MediaWiki-User-login-and-signup, MediaWiki-Debug-Logger, Security
Tgr added a comment to T395204: MediaWiki should log request information (IP, user agent, referrer, HTTP method, etc) in a more uniform and predictable way.

Some examples of what's logged currently (per this search:

  • WebProcessor (added to all logs): url, http_method, referrer, reqId, ip (not the real IP though)
  • RateLimiter: name, ip
  • action API feature usage: username, clientip, agent, referer
  • AuthManager: user, clientip
  • SpamRegexConstraint in EditPage: ip
  • ChronologyProtector: clientIP, clientAgent
  • SessionManager / SessionBackend: clientip, user, userAgent
  • OATH: user / clientip
  • goodpass/badpass in Wikimedia config: name, user group / privilege information, clientip, xff, ua, geocookie
  • CentralAuth login: user, clientip, ua
  • IPReputation: ip
  • EmailAuth: user, ua, ip
  • EmailAuth (in WikimediaEvents): user, ua, ip, group / LoginNotify / IPoid / geocookie / 2FA / activity info
  • LoginNotify: name, ip / clientip, ua, xff, geocookie
  • OAuth: user, clientip
  • ConfirmEdit: user, clientip, ua
  • StopForumSpam: user, clientip
Sun, May 25, 2:59 PM · MediaWiki-Platform-Team, Patch-For-Review, MediaWiki-User-login-and-signup, MediaWiki-Debug-Logger, Security
Tgr added a project to T395204: MediaWiki should log request information (IP, user agent, referrer, HTTP method, etc) in a more uniform and predictable way: MediaWiki-User-login-and-signup.
Sun, May 25, 2:33 PM · MediaWiki-Platform-Team, Patch-For-Review, MediaWiki-User-login-and-signup, MediaWiki-Debug-Logger, Security
Tgr created T395204: MediaWiki should log request information (IP, user agent, referrer, HTTP method, etc) in a more uniform and predictable way.
Sun, May 25, 2:33 PM · MediaWiki-Platform-Team, Patch-For-Review, MediaWiki-User-login-and-signup, MediaWiki-Debug-Logger, Security

Sat, May 17

matmarex added a comment to T353339: Add support for dynamic placeholder replacement in logger..

I feel like this idea is mostly covered by the newly added "global log context": T142313: Add global information to debug logger context

Sat, May 17, 12:15 AM · MediaWiki-Platform-Team (Roadmap), Patch-For-Review, MediaWiki-Debug-Logger

Mon, May 12

Tgr added a comment to T393463: Add reviewing JS errors on authentication pages / the auth domain to MediaWiki Platform team chores.

Here's a very rough first approximation: https://logstash.wikimedia.org/goto/7c72bf2d02c84f4a56803129a1b16042

Mon, May 12, 7:08 PM · MediaWiki-Debug-Logger, MediaWiki-extensions-WikimediaEvents, MediaWiki-Platform-Team
JTweed-WMF moved T393463: Add reviewing JS errors on authentication pages / the auth domain to MediaWiki Platform team chores from Inbox, needs triage to Needs refinement on the MediaWiki-Platform-Team board.
Mon, May 12, 2:59 PM · MediaWiki-Debug-Logger, MediaWiki-extensions-WikimediaEvents, MediaWiki-Platform-Team
Krinkle added projects to T393463: Add reviewing JS errors on authentication pages / the auth domain to MediaWiki Platform team chores: MediaWiki-extensions-WikimediaEvents, MediaWiki-Debug-Logger.
Mon, May 12, 2:59 PM · MediaWiki-Debug-Logger, MediaWiki-extensions-WikimediaEvents, MediaWiki-Platform-Team

May 6 2025

Tgr added a comment to T142313: Add global information to debug logger context.

(wikitech-l announcement)

May 6 2025, 10:15 PM · MW-1.44-notes (1.44.0-wmf.27; 2025-04-29), MediaWiki-Platform-Team, Observability-Logging, Platform Team Legacy (Watching / External), Services (watching), User-Tgr, Developer-Wishlist (2017), MediaWiki-Debug-Logger
matmarex closed T142313: Add global information to debug logger context as Resolved.

With @Tgr's patch, you can now add global information to debug logger context using:

LoggerFactory::getContext()->add(<array>)

or (within the lifetime of a scope variable):

$scope = LoggerFactory::getContext()->addScoped(<array>)
May 6 2025, 9:54 PM · MW-1.44-notes (1.44.0-wmf.27; 2025-04-29), MediaWiki-Platform-Team, Observability-Logging, Platform Team Legacy (Watching / External), Services (watching), User-Tgr, Developer-Wishlist (2017), MediaWiki-Debug-Logger