BryanDavis has uploaded a new change for review.
https://gerrit.wikimedia.org/r/181350
Change subject: monolog: honor log sampling for logstash
......................................................................
monolog: honor log sampling for logstash
Use a MWLoggerMonologSamplingHandler to wrap the shared logstash handler
when the $wgDebugLogGroups for a given group specifies a sample factor.
Change-Id: I6d79f27e59cbd5ed0dd441707b328179102cb2f0
Depends-On: Icd14fc8c44ca9eef0f3f5cc4f1d1d8b68d517f07
Bug: T85067
---
M wmf-config/logging.php
1 file changed, 20 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config
refs/changes/50/181350/1
diff --git a/wmf-config/logging.php b/wmf-config/logging.php
index 4eb6986..a4eacd9 100644
--- a/wmf-config/logging.php
+++ b/wmf-config/logging.php
@@ -73,11 +73,30 @@
// Add logging channels defined in $wgDebugLogGroups
foreach ( $wgDebugLogGroups as $group => $dest ) {
+ $sample = false;
if ( is_array( $dest ) ) {
+ // NOTE: sampled logs are not guaranteed to store the
same events
+ // in logstash and via udp2log since the two event
handlers
+ // independently check the probability of emitting.
+ $sample = isset( $dest['sample'] ) ? $dest['sample'] :
false;
$dest = $dest['destination'];
}
+ if ( $sample === false ) {
+ $handlers = array( $group, 'logstash' );
+ } else {
+ $wmgMonologConfig['handlers']["sampled-{$group}"] =
array(
+ 'class' => 'MWLoggerMonologSamplingHandler',
+ 'args' => array(
+ function() {
+ return
MWLogger::getProvider()->getHandler( 'logstash' );
+ },
+ $sample,
+ ),
+ );
+ $handlers = array( $group, "sampled-{$group}" );
+ }
$wmgMonologConfig['loggers'][$group] = array(
- 'handlers' => array( $group, 'logstash' ),
+ 'handlers' => $handlers,
'processors' => array( 'wiki', 'psr', 'pid', 'uid',
'web' ),
);
$wmgMonologConfig['handlers'][$group] = array(
--
To view, visit https://gerrit.wikimedia.org/r/181350
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6d79f27e59cbd5ed0dd441707b328179102cb2f0
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: BryanDavis <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits