jenkins-bot has submitted this change and it was merged.

Change subject: Add log rotation
......................................................................


Add log rotation

Rotate $wgDebugLogFile log file, and the three $wgDebugLogGroups
files defined in the top-level LocalSettings.php.

Fixes T92594

Bug: T92594
Change-Id: I6af4ead21bf3f867d10cf46055a20f85e5a3d6a4
---
A puppet/modules/mediawiki/files/wiki/logrotate.d-mediawiki-shared-log-groups
M puppet/modules/mediawiki/manifests/init.pp
M puppet/modules/mediawiki/manifests/wiki.pp
A puppet/modules/mediawiki/templates/logrotate.d-mediawiki-debug-log.erb
M puppet/modules/mediawiki/templates/multiwiki/CommonSettings.php.erb
M puppet/modules/mediawiki/templates/wiki/wgConf.php.erb
6 files changed, 44 insertions(+), 3 deletions(-)

Approvals:
  BryanDavis: Looks good to me, approved
  jenkins-bot: Verified



diff --git 
a/puppet/modules/mediawiki/files/wiki/logrotate.d-mediawiki-shared-log-groups 
b/puppet/modules/mediawiki/files/wiki/logrotate.d-mediawiki-shared-log-groups
new file mode 100644
index 0000000..f67cdd5
--- /dev/null
+++ 
b/puppet/modules/mediawiki/files/wiki/logrotate.d-mediawiki-shared-log-groups
@@ -0,0 +1,13 @@
+# logrotate config for MediaWiki shared log files
+# See top-level LocalSettings.php
+# This file is managed by Puppet
+
+/vagrant/logs/mediawiki-exception.log /vagrant/logs/mediawiki-runJobs.log 
/vagrant/logs/mediawiki-JobQueueRedis.log {
+    daily
+    missingok
+    rotate 7
+    compress
+    notifempty
+    nocreate
+    nomail
+}
diff --git a/puppet/modules/mediawiki/manifests/init.pp 
b/puppet/modules/mediawiki/manifests/init.pp
index 3481b30..91c4a8e 100644
--- a/puppet/modules/mediawiki/manifests/init.pp
+++ b/puppet/modules/mediawiki/manifests/init.pp
@@ -169,7 +169,7 @@
     }
 
     php::composer::install { $dir:
-        require     => Git::Clone['mediawiki/core'],
+        require => Git::Clone['mediawiki/core'],
     }
 
     env::profile_script { 'add mediawiki vendor bin to path':
@@ -183,4 +183,11 @@
     mediawiki::import_text { 'Template:Main_Page':
         source => 'puppet:///modules/mediawiki/main_page_template.wiki',
     }
+
+    file { '/etc/logrotate.d/mediawiki_shared_log_groups':
+        source  => 
'puppet:///modules/mediawiki/wiki/logrotate.d-mediawiki-shared-log-groups',
+        owner   => 'root',
+        group   => 'root',
+        mode    => '0444',
+    }
 }
diff --git a/puppet/modules/mediawiki/manifests/wiki.pp 
b/puppet/modules/mediawiki/manifests/wiki.pp
index 3987977..f8fc08e 100644
--- a/puppet/modules/mediawiki/manifests/wiki.pp
+++ b/puppet/modules/mediawiki/manifests/wiki.pp
@@ -106,6 +106,9 @@
         ensure => directory,
     }
 
+    # $wgDebugLogFile
+    $debug_log_file = "/vagrant/logs/mediawiki-${db_name}-debug.log"
+
     file { "${settings_root}/wgConf.php":
         ensure  => present,
         mode    => '0644',
@@ -118,6 +121,13 @@
         content => template('mediawiki/wiki/dbConf.php.erb'),
     }
 
+    file { "/etc/logrotate.d/mediawiki_${db_name}_debug_log":
+        content => template('mediawiki/logrotate.d-mediawiki-debug-log.erb'),
+        owner   => 'root',
+        group   => 'root',
+        mode    => '0444',
+    }
+
     file { $settings_dir:
         ensure  => directory,
     }
diff --git 
a/puppet/modules/mediawiki/templates/logrotate.d-mediawiki-debug-log.erb 
b/puppet/modules/mediawiki/templates/logrotate.d-mediawiki-debug-log.erb
new file mode 100644
index 0000000..49fdafa
--- /dev/null
+++ b/puppet/modules/mediawiki/templates/logrotate.d-mediawiki-debug-log.erb
@@ -0,0 +1,12 @@
+# logrotate config for MediaWiki wgDebugLogFIle
+# This file is managed by Puppet
+
+<%= @debug_log_file %> {
+    daily
+    missingok
+    rotate 7
+    compress
+    notifempty
+    nocreate
+    nomail
+}
diff --git 
a/puppet/modules/mediawiki/templates/multiwiki/CommonSettings.php.erb 
b/puppet/modules/mediawiki/templates/multiwiki/CommonSettings.php.erb
index cb833f3..6d9cb45 100644
--- a/puppet/modules/mediawiki/templates/multiwiki/CommonSettings.php.erb
+++ b/puppet/modules/mediawiki/templates/multiwiki/CommonSettings.php.erb
@@ -22,8 +22,6 @@
 
 include_once __DIR__ . '/LoadWgConf.php';
 
-$wgDebugLogFile = "/vagrant/logs/mediawiki-{$wgDBname}-debug.log";
-
 foreach(
        array_merge(
                // Settings from default wiki
diff --git a/puppet/modules/mediawiki/templates/wiki/wgConf.php.erb 
b/puppet/modules/mediawiki/templates/wiki/wgConf.php.erb
index 9ce8b31..13720f9 100644
--- a/puppet/modules/mediawiki/templates/wiki/wgConf.php.erb
+++ b/puppet/modules/mediawiki/templates/wiki/wgConf.php.erb
@@ -9,3 +9,4 @@
 $wgConf->settings['wgCacheDirectory']['<%= @db_name %>'] = '<%= @cache_dir %>';
 $wgConf->settings['wgFileCacheDirectory']['<%= @db_name %>'] = '<%= @cache_dir 
%>';
 $wgConf->settings['wgUploadDirectory']['<%= @db_name %>'] = '<%= @upload_dir 
%>';
+$wgConf->settings['wgDebugLogFile']['<%= @db_name %>'] = '<%= @debug_log_file 
%>';

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6af4ead21bf3f867d10cf46055a20f85e5a3d6a4
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <mflasc...@wikimedia.org>
Gerrit-Reviewer: BryanDavis <bda...@wikimedia.org>
Gerrit-Reviewer: Dduvall <dduv...@wikimedia.org>
Gerrit-Reviewer: Mattflaschen <mflasc...@wikimedia.org>
Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to