Hello Ori.livneh, Ottomata,

I'd like you to do a code review.  Please visit

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

to review the following change.

Change subject: Extract EventLoggings log directory into a variable
......................................................................

Extract EventLoggings log directory into a variable

vanadium is running low on space on the disk that EventLogging is
logging to. Since vanadium has a pretty empty mount, we prepare to
move the log files to a directory on this rather empty mount. To ease
this switch, we extract the currently hard-coded paths into a
variable.

Change-Id: If4839e99cc87c99a09e2373122678fb9b4c787eb
---
M manifests/role/eventlogging.pp
M modules/eventlogging/files/logrotate
M modules/eventlogging/manifests/init.pp
3 files changed, 16 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/05/172705/1

diff --git a/manifests/role/eventlogging.pp b/manifests/role/eventlogging.pp
index 16d825c..8fff122 100644
--- a/manifests/role/eventlogging.pp
+++ b/manifests/role/eventlogging.pp
@@ -94,19 +94,21 @@
     ## 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 stat1003 & stat1002 for backup.
+    # $log_dir as a medium of last resort. These files are rotated
+    # and rsynced to stat1003 & stat1002 for backup.
+
+    $log_dir = $::eventlogging::log_dir
 
     eventlogging::service::consumer {
         'server-side-events.log':
             input  => "tcp://${processor}:8421?raw=1",
-            output => 'file:///var/log/eventlogging/server-side-events.log';
+            output => "file://${log_dir}/server-side-events.log";
         'client-side-events.log':
             input  => "tcp://${processor}:8422?raw=1",
-            output => 'file:///var/log/eventlogging/client-side-events.log';
+            output => "file://${log_dir}/client-side-events.log";
         'all-events.log':
             input  => "tcp://${processor}:8600",
-            output => 'file:///var/log/eventlogging/all-events.log';
+            output => "file://${log_dir}/all-events.log";
     }
 
     $backup_destinations = $::realm ? {
@@ -118,10 +120,10 @@
         include rsync::server
 
         rsync::server::module { 'eventlogging':
-            path        => '/var/log/eventlogging',
+            path        => $log_dir,
             read_only   => 'yes',
             list        => 'yes',
-            require     => File['/var/log/eventlogging'],
+            require     => File[$log_dir],
             hosts_allow => $backup_destinations,
         }
     }
diff --git a/modules/eventlogging/files/logrotate 
b/modules/eventlogging/files/logrotate
index e5bf8e6..a5834e7 100644
--- a/modules/eventlogging/files/logrotate
+++ b/modules/eventlogging/files/logrotate
@@ -1,9 +1,9 @@
 # This file is managed by Puppet.
 # puppet:///modules/eventlogging/logrotate
 
-/var/log/eventlogging/*.log {
+<%= @log_dir =>/*.log {
        daily
-       olddir /var/log/eventlogging/archive
+       olddir <%= @log_dir %>/archive
        notifempty
        maxage 45
        rotate 1000
diff --git a/modules/eventlogging/manifests/init.pp 
b/modules/eventlogging/manifests/init.pp
index 0cedc4b..a4c3234 100644
--- a/modules/eventlogging/manifests/init.pp
+++ b/modules/eventlogging/manifests/init.pp
@@ -42,6 +42,8 @@
     include ::eventlogging::package
     include ::eventlogging::monitoring
 
+    $log_dir = '/var/log/eventlogging'
+
     group { 'eventlogging':
         ensure => present,
     }
@@ -102,8 +104,8 @@
         ensure => directory,
     }
 
-    # Logs are collected in </var/log/eventlogging> and rotated daily.
-    file { [ '/var/log/eventlogging', '/var/log/eventlogging/archive' ]:
+    # Logs are collected in <$log_dir> and rotated daily.
+    file { [ $log_dir, "${log_dir}/archive" ]:
         ensure  => directory,
         owner   => 'eventlogging',
         group   => 'eventlogging',
@@ -112,7 +114,7 @@
 
     file { '/etc/logrotate.d/eventlogging':
         source  => 'puppet:///modules/eventlogging/logrotate',
-        require => File['/var/log/eventlogging/archive'],
+        require => File["${log_dir}/archive"],
         mode    => '0444',
     }
 }

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

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

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

Reply via email to