Ori.livneh has uploaded a new change for review.

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


Change subject: Make rsyslog forward Apache error log to fluorine
......................................................................

Make rsyslog forward Apache error log to fluorine

Currently Apache's error log is sent to syslog, which writes it to
/var/log/apache2.log on each application server. This patch makes rsyslog also
forward a copy of each log message to the MediaWiki log aggregator. The logs
are formatted for compatibility with the demuxer on fluorine.

Change-Id: I31c76fdde57c11e58f7b227fb3a87f10f64cf71d
---
M manifests/role/applicationserver.pp
M modules/applicationserver/manifests/syslog.pp
R templates/rsyslog/40-appserver.conf.erb
3 files changed, 19 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/59/96659/1

diff --git a/manifests/role/applicationserver.pp 
b/manifests/role/applicationserver.pp
index d1e6318..9314ead 100644
--- a/manifests/role/applicationserver.pp
+++ b/manifests/role/applicationserver.pp
@@ -16,17 +16,15 @@
 
 class role::applicationserver {
 
+       $mediawiki_log_aggregator = $::realm ? {
+               'production' => 'fluorine.eqiad.wmnet:8420',
+               'labs'       => 'deployment-bastion.pmtpa.wmflabs:8420',
+       }
+
        class configuration::php {
-               # Passed to wmerrors extension
-               $fatal_log_file = $::realm ? {
-                       'production' => 'udp://10.64.0.21:8420',
-                       'labs'       => 'udp://10.4.0.58:8420',  # 
deployment-bastion
-               }
-
                class { 'applicationserver::config::php':
-                       fatal_log_file => $fatal_log_file,
+                       fatal_log_file => "udp://${mediawiki_log_aggregator}",
                }
-
        }
 
 # Class: role::applicationserver
@@ -94,11 +92,14 @@
        class webserver($maxclients="40") {
                include ::applicationserver,
                        applicationserver::pybal_check,
-                       applicationserver::syslog,
                        role::applicationserver::configuration::php
 
                class { "applicationserver::config::apache": maxclients => 
$maxclients }
 
+               class { '::applicationserver::syslog':
+                       apache_log_aggregator => 
$::role::applicationserver::mediawiki_log_aggregator,
+               }
+
                monitor_service { "appserver http":
                        description => "Apache HTTP",
                        check_command => $::realm ? {
diff --git a/modules/applicationserver/manifests/syslog.pp 
b/modules/applicationserver/manifests/syslog.pp
index 18ef1c4..a64d1d6 100644
--- a/modules/applicationserver/manifests/syslog.pp
+++ b/modules/applicationserver/manifests/syslog.pp
@@ -1,5 +1,5 @@
 # syslog instance and configuration for applicationservers
-class applicationserver::syslog {
+class applicationserver::syslog( $apache_log_aggregator ) {
        require base::remote-syslog
 
        file {
@@ -8,7 +8,7 @@
                        owner => root,
                        group => root,
                        mode => 0444,
-                       source => "puppet:///files/rsyslog/40-appserver.conf",
+                       content => template("rsyslog/40-appserver.conf.erb"),
                        ensure => present;
                "/usr/local/bin/apache-syslog-rotate":
                        owner => root,
diff --git a/files/rsyslog/40-appserver.conf 
b/templates/rsyslog/40-appserver.conf.erb
similarity index 63%
rename from files/rsyslog/40-appserver.conf
rename to templates/rsyslog/40-appserver.conf.erb
index a9a978f..a528f8d 100644
--- a/files/rsyslog/40-appserver.conf
+++ b/templates/rsyslog/40-appserver.conf.erb
@@ -1,7 +1,10 @@
 #####################################################################
 ### THIS FILE IS MANAGED BY PUPPET 
-### puppet:///files/rsyslog/40-appserver.conf
+### puppet:///rsyslog/40-appserver.conf.erb
 #####################################################################
+
+# Emulate MediaWiki's wfDebugLog / wfErrorLog format
+$template MediaWiki,"%programname% %timegenerated% %HOSTNAME%: %msg%\n"
 
 # Maximum 100MB log file size
 $outchannel 
apache2,/var/log/apache2.log,100000000,/usr/local/bin/apache-syslog-rotate
@@ -9,6 +12,8 @@
 # Send apache2 messages to the apache output channel
 :programname,isequal,"apache2" $apache2
 
+# ..and to the MediaWiki log aggregator
+& @<%= @apache_log_aggregator %>;MediaWiki
+
 # Discard apache2 messages before they get to 50-default.conf
-# This should be after remote logging if you want remote logging of apache 
messages
 & ~

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I31c76fdde57c11e58f7b227fb3a87f10f64cf71d
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Ori.livneh <[email protected]>

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

Reply via email to