Gehel has uploaded a new change for review.

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

Change subject: osm - move logs to /var/log
......................................................................

osm - move logs to /var/log

The logs from planet_sync were written to /tmp. Having logs under /var/log
is more usual. This change also appends to log instead of overwritting them
at each invocation, and adds a logrotate rule to ensure the logs are rotated.

Change-Id: Ic746579b2c2c56aeba2359f0b3a78d49f52f4c23
---
M modules/osm/manifests/planet_sync.pp
A modules/osm/templates/planetsync-logrotate.conf.erb
M modules/osm/templates/replicate-osm.erb
3 files changed, 43 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/48/312248/1

diff --git a/modules/osm/manifests/planet_sync.pp 
b/modules/osm/manifests/planet_sync.pp
index 4f4ad8b..3106ffc 100644
--- a/modules/osm/manifests/planet_sync.pp
+++ b/modules/osm/manifests/planet_sync.pp
@@ -67,6 +67,8 @@
 ) {
     include ::osm::users
 
+    $osm_log_dir = '/var/log/osmosis/'
+
     file { '/srv/downloads':
         ensure => 'directory',
         owner  => 'osmupdater',
@@ -104,9 +106,21 @@
         content => template('osm/osmosis_configuration.txt.erb'),
     }
 
+    file { $osm_log_dir:
+        ensure => directory,
+        owner  => 'osmupdater',
+        group  => 'osmupdater',
+        mode   => '0755',
+    }
+
+    logrotate::conf { 'planetsync':
+        ensure  => present,
+        content => template('osm/planetsync-logrotate.conf.erb'),
+    }
+
     cron { "planet_sync-${name}":
         ensure      => $ensure,
-        command     => '/usr/local/bin/replicate-osm > /tmp/osm2pgsql.log 
2>&1',
+        command     => "/usr/local/bin/replicate-osm >> 
${osm_log_dir}/osm2pgsql.log 2>&1",
         user        => 'osmupdater',
         hour        => $hour,
         minute      => $minute,
diff --git a/modules/osm/templates/planetsync-logrotate.conf.erb 
b/modules/osm/templates/planetsync-logrotate.conf.erb
new file mode 100644
index 0000000..6627eee
--- /dev/null
+++ b/modules/osm/templates/planetsync-logrotate.conf.erb
@@ -0,0 +1,27 @@
+#####################################################################
+### THIS FILE IS MANAGED BY PUPPET
+#####################################################################
+
+<%= @osm_log_dir %>/osmosis.log {
+  daily
+  notifempty
+  maxage 30
+  rotate 5
+  dateext
+  compress
+  delaycompress
+  missingok
+  nocreate
+}
+
+<%= @osm_log_dir %>/osm2pgsql.log {
+  daily
+  notifempty
+  maxage 30
+  rotate 5
+  dateext
+  compress
+  delaycompress
+  missingok
+  nocreate
+}
diff --git a/modules/osm/templates/replicate-osm.erb 
b/modules/osm/templates/replicate-osm.erb
index 4ab79c2..a80d5b2 100644
--- a/modules/osm/templates/replicate-osm.erb
+++ b/modules/osm/templates/replicate-osm.erb
@@ -14,7 +14,7 @@
        --read-replication-interval \
        workingDirectory=<%= @osmosis_dir %> \
        --simplify-change \
-       --write-xml-change - 2>/tmp/osmosis.log \
+       --write-xml-change - 2>> <%= @osm_log_dir %>/osmosis.log \
     | /usr/bin/osm2pgsql \
       --hstore \
       --slim \

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic746579b2c2c56aeba2359f0b3a78d49f52f4c23
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Gehel <gleder...@wikimedia.org>

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

Reply via email to