Filippo Giunchedi has uploaded a new change for review.

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

Change subject: swift: separate access log from general log
......................................................................

swift: separate access log from general log

move access log to LOCAL1 and split that with rsyslog, rotation by logrotate

RT #8181

Change-Id: Ic089505cac44de8b23086fad74056db87e63a155
---
A files/swift/swift-proxy.logrotate.conf
A files/swift/swift-proxy.rsyslog.conf
M manifests/swift.pp
M templates/swift/proxy-server.conf.erb
4 files changed, 28 insertions(+), 0 deletions(-)


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

diff --git a/files/swift/swift-proxy.logrotate.conf 
b/files/swift/swift-proxy.logrotate.conf
new file mode 100644
index 0000000..632d662
--- /dev/null
+++ b/files/swift/swift-proxy.logrotate.conf
@@ -0,0 +1,12 @@
+/var/log/swift-access.log
+{
+    rotate 7
+    daily
+    missingok
+    notifempty
+    delaycompress
+    compress
+    postrotate
+        reload rsyslog >/dev/null 2>&1 || true
+    endscript
+}
diff --git a/files/swift/swift-proxy.rsyslog.conf 
b/files/swift/swift-proxy.rsyslog.conf
new file mode 100644
index 0000000..7839ab8
--- /dev/null
+++ b/files/swift/swift-proxy.rsyslog.conf
@@ -0,0 +1,4 @@
+if $syslogfacility-text == 'local1' \
+  and $programname == 'proxy-server' \
+    then /var/log/swift-access.log
+& ~
diff --git a/manifests/swift.pp b/manifests/swift.pp
index c279fe4..2b1af7c 100644
--- a/manifests/swift.pp
+++ b/manifests/swift.pp
@@ -149,6 +149,17 @@
         require => Package['swift'],
     }
 
+    file { '/etc/logrotate.d/swift-proxy':
+        ensure => present,
+        source => 'puppet:///files/swift/swift-proxy.logrotate.conf',
+        mode   => '0444',
+    }
+
+    rsyslog::conf { 'swift-proxy':
+        source   => 'puppet:///files/swift/swift-proxy.rsyslog.conf',
+        priority => 30,
+    }
+
     package {[
             'swift-proxy',
             'python-swauth'
diff --git a/templates/swift/proxy-server.conf.erb 
b/templates/swift/proxy-server.conf.erb
index 43ff198..cbec079 100644
--- a/templates/swift/proxy-server.conf.erb
+++ b/templates/swift/proxy-server.conf.erb
@@ -65,6 +65,7 @@
 
 [filter:proxy-logging]
 use = egg:swift#proxy_logging
+set access_log_facility = LOG_LOCAL1
 
 [filter:rewrite]
 # the auth system turns our login and key into an account / token pair.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic089505cac44de8b23086fad74056db87e63a155
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Filippo Giunchedi <[email protected]>

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

Reply via email to