Hashar has uploaded a new change for review.

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

Change subject: Stop logging xff from 127.0.0.1
......................................................................

Stop logging xff from 127.0.0.1

In November 2013 we started logging XFF and the protocol to the
'localhost' log bucket ( 66af43f448 ).  I am pretty sure that was to
help transitionning relative URL for http/https.

POST requests having a X-Forwarded-For header are logged under the `xff'
log bucket, the main source of log are the jobrunner hitting the
/rpc/RunJobs.php interface.  There is no need to log such requests.

On fluorine, the xff.log archives are 5GBytes compressed and the
localhost.log ones 3GBytes for a total of almost 1TBytes.

Make our extension function for XFF logging to skip whenever the request
IP is 127.0.0.1 and drop the protocol logging entirely

The log bucket 'localhost' is left configured:
  wmgMonologChannels['default']['localhost']

It might be used outside of that extension function.

Bug: T129982
Change-Id: I77f4b9c9634e62d5cae07e7d9a92a055c9f8f896
---
M wmf-config/CommonSettings.php
1 file changed, 5 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config 
refs/changes/39/301339/1

diff --git a/wmf-config/CommonSettings.php b/wmf-config/CommonSettings.php
index b756187..bc07a50 100644
--- a/wmf-config/CommonSettings.php
+++ b/wmf-config/CommonSettings.php
@@ -1096,7 +1096,11 @@
 # XFF log for vandal tracking
 $wgExtensionFunctions[] = function() {
        global $wmfUdp2logDest, $wgRequest;
-       if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] 
=== 'POST' ) {
+       if (
+               isset( $_SERVER['REQUEST_METHOD'] )
+               && $_SERVER['REQUEST_METHOD'] === 'POST'
+               && $wgRequest->getIP() !== '127.0.0.1'  # T129982
+       ) {
                $uri = ( ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] ) ? 
'https://' : 'http://' ) .
                        $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
                $xff = isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ? 
$_SERVER['HTTP_X_FORWARDED_FOR'] : '';
@@ -1109,17 +1113,6 @@
                        "$xff, {$_SERVER['REMOTE_ADDR']}\t" .
                        ( ( isset( $_REQUEST['wpSave'] ) && $_REQUEST['wpSave'] 
) ? 'save' : '' )
                );
-               if ( $wgRequest->getIP() === '127.0.0.1' ) {
-                       $logger = LoggerFactory::getInstance( 'localhost' );
-                       // TODO: it would be nice to log this as actual 
structured data
-                       // instead of this ad-hoc tab delimited format
-                       $logger->info(
-                               gmdate( 'r' ) . "\t" .
-                               wfHostname() .
-                               "\t$xff, {$_SERVER['REMOTE_ADDR']}\t" .
-                               WebRequest::detectProtocol()
-                       );
-               }
        }
 };
 

-- 
To view, visit https://gerrit.wikimedia.org/r/301339
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I77f4b9c9634e62d5cae07e7d9a92a055c9f8f896
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Hashar <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to