Andrew Bogott has submitted this change and it was merged. Change subject: Document 'eventlogging' role ......................................................................
Document 'eventlogging' role This patch provides additional documentation and re-orders resource declarations to provide a description of EventLogging data flow. It does not include any configuration changes. Change-Id: I3cc4edefcbadb3a3cf336e5a30a2dd3ca302d7ee --- M manifests/role/eventlogging.pp 1 file changed, 115 insertions(+), 59 deletions(-) Approvals: Andrew Bogott: Looks good to me, approved jenkins-bot: Verified diff --git a/manifests/role/eventlogging.pp b/manifests/role/eventlogging.pp index 32d21f3..c51aa61 100644 --- a/manifests/role/eventlogging.pp +++ b/manifests/role/eventlogging.pp @@ -1,75 +1,131 @@ # == Class: role::eventlogging +# # This role configures an instance to act as the primary EventLogging # log processor for the cluster. The setup is described in detail on -# <https://wikitech.wikimedia.org/wiki/EventLogging>. +# <https://wikitech.wikimedia.org/wiki/EventLogging>. End-user +# documentation is available in the form of a guide, located at +# <https://www.mediawiki.org/wiki/Extension:EventLogging/Guide>. # -# XXX(ori-l, 3-Jul-2013): Document this better. +# There exist two APIs for generating events: efLogServerSideEvent() in +# PHP and mw.eventLog.logEvent() in JavaScript. Events generated in PHP +# are sent by the app servers directly to vanadium on UDP port 8421. +# JavaScript-generated events are URL-encoded and sent to our servers by +# means of an HTTP/S request to bits, which a varnishncsa instance +# forwards to vanadium on port 8422. These event streams are parsed, +# validated, and multiplexed into an output stream that is published via +# ZeroMQ on TCP port 8600. Data sinks are implemented as subscribers +# that connect to this endpoint and read data into some storage medium. # class role::eventlogging { - system_role { 'misc::log-collector': - description => 'EventLogging log collector', - } + include eventlogging + include eventlogging::monitor - include eventlogging - include eventlogging::monitor + system_role { 'role::eventlogging': + description => 'EventLogging', + } - class { 'eventlogging::archive': - destinations => [ 'stat1.wikimedia.org', 'stat1002.eqiad.wmnet' ], - } - class { 'mongodb': - dbpath => '/srv/mongodb', - bind_ip => false, - auth => true, - } + ## Data flow - require passwords::mongodb::eventlogging # RT 5101 - $mongo_user = $passwords::mongodb::eventlogging::user - $mongo_pass = $passwords::mongodb::eventlogging::password + # Server-side events are generated by MediaWiki and sent to vanadium + # on UDP port 8421, using wfErrorLog('...', 'udp://...'). vanadium + # is specified as the destination in $wgEventLoggingFile, declared + # in wmf-config/CommonSettings.php. - require passwords::mysql::eventlogging # RT 4752 - $mysql_user = $passwords::mysql::eventlogging::user - $mysql_pass = $passwords::mysql::eventlogging::password + eventlogging::service::forwarder { '8421': + ensure => present, + count => true, + } - eventlogging::service::forwarder { - '8421': - ensure => present, - count => true; - '8422': - ensure => present; - } + eventlogging::service::processor { 'server-side events': + format => '%n EventLogging %j', + input => 'tcp://localhost:8421', + output => 'tcp://*:8521', + } - eventlogging::service::processor { - 'server-side events': - format => '%n EventLogging %j', - input => 'tcp://localhost:8421', - output => 'tcp://*:8521'; - 'client-side events': - format => '%q %l %n %t %h', - input => 'tcp://localhost:8422', - output => 'tcp://*:8522'; - } + # Client-side events are generated by JavaScript-triggered HTTP/S + # requests to //bits.wikimedia.org/event.gif?<event payload>. + # A varnishncsa instance on the bits caches greps for these requests + # and forwards them to vanadium on UDP port 8422. The varnishncsa + # configuration is specified in <manifests/role/cache.pp>. - eventlogging::service::multiplexer { 'all events': - inputs => [ 'tcp://127.0.0.1:8521', 'tcp://127.0.0.1:8522' ], - output => 'tcp://*:8600', - } + eventlogging::service::forwarder { '8422': + ensure => present, + } - eventlogging::service::consumer { - 'vanadium': - input => 'tcp://vanadium.eqiad.wmnet:8600', - output => "mongodb://${mongo_user}:${mongo_pass}@vanadium.eqiad.wmnet:27017"; - 'mysql-db1047': - input => 'tcp://vanadium.eqiad.wmnet:8600', - output => "mysql://${mysql_user}:${mysql_pass}@db1047.eqiad.wmnet/log?charset=utf8"; - 'server-side-events.log': - input => 'tcp://vanadium.eqiad.wmnet:8421', - output => 'file:///var/log/eventlogging/server-side-events.log'; - 'client-side-events.log': - input => 'tcp://vanadium.eqiad.wmnet:8422', - output => 'file:///var/log/eventlogging/client-side-events.log'; - 'all-events.log': - input => 'tcp://vanadium.eqiad.wmnet:8600', - output => 'file:///var/log/eventlogging/all-events.log'; - } + eventlogging::service::processor { 'client-side events': + format => '%q %l %n %t %h', + input => 'tcp://localhost:8422', + output => 'tcp://*:8522', + } + + # Parsed and validated client-side (Varnish-generated) and + # server-side (MediaWiki-generated) events are multiplexed into a + # single output stream, published on TCP port 8600. + + eventlogging::service::multiplexer { 'all events': + inputs => [ 'tcp://127.0.0.1:8521', 'tcp://127.0.0.1:8522' ], + output => 'tcp://*:8600', + } + + + ## MongoDB + + # Log events to a local MongoDB instance. + + include passwords::mongodb::eventlogging # RT 5101 + $mongo_user = $passwords::mongodb::eventlogging::user + $mongo_pass = $passwords::mongodb::eventlogging::password + + class { 'mongodb': + dbpath => '/srv/mongodb', + bind_ip => false, + auth => true, + } + + eventlogging::service::consumer { 'vanadium': + input => 'tcp://vanadium.eqiad.wmnet:8600', + output => "mongodb://${mongo_user}:${mongo_pass}@vanadium.eqiad.wmnet:27017", + } + + + ## MySQL / MariaDB + + # Log strictly valid events to the 'log' database on db1047. This is the + # primary medium for data analysis as of July 2013. + + include passwords::mysql::eventlogging # RT 4752 + $mysql_user = $passwords::mysql::eventlogging::user + $mysql_pass = $passwords::mysql::eventlogging::password + + eventlogging::service::consumer { 'mysql-db1047': + input => 'tcp://vanadium.eqiad.wmnet:8600', + output => "mysql://${mysql_user}:${mysql_pass}@db1047.eqiad.wmnet/log?charset=utf8", + } + + + ## Flat files + + # Log all raw log records and decoded events to flat files in + # /var/log/eventlogging as a medium of last resort. These files + # are rotated and rsynced to stat1 & stat1002 for backup. + + eventlogging::service::consumer { + 'server-side-events.log': + input => 'tcp://vanadium.eqiad.wmnet:8421', + output => 'file:///var/log/eventlogging/server-side-events.log'; + 'client-side-events.log': + input => 'tcp://vanadium.eqiad.wmnet:8422', + output => 'file:///var/log/eventlogging/client-side-events.log'; + 'all-events.log': + input => 'tcp://vanadium.eqiad.wmnet:8600', + output => 'file:///var/log/eventlogging/all-events.log'; + } + + class { 'eventlogging::archive': + destinations => [ + 'stat1.wikimedia.org', + 'stat1002.eqiad.wmnet' + ], + } } -- To view, visit https://gerrit.wikimedia.org/r/73997 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I3cc4edefcbadb3a3cf336e5a30a2dd3ca302d7ee Gerrit-PatchSet: 2 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Ori.livneh <[email protected]> Gerrit-Reviewer: Andrew Bogott <[email protected]> Gerrit-Reviewer: Faidon <[email protected]> Gerrit-Reviewer: Ori.livneh <[email protected]> Gerrit-Reviewer: Spage <[email protected]> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
