From 106c825575eebdd88cdc2e88334dc6866ef3d487 Mon Sep 17 00:00:00 2001 From: Pete Zaitcev Date: Oct 28 2014 00:41:59 +0000 Subject: Redirect logging to /var/log/swift/swift.log The thorniest problem with making Swift log like any other OpenStack component is that it uses syslog. Therefore, it must use one of the pre-defined logging facilities, and we cannot be sure that there is no conflict. We're taking this risk because the current situation is worse. See the bug 997983 for the long deliberation. Resolves: rhbz#997983 --- diff --git a/openstack-swift.logrotate b/openstack-swift.logrotate new file mode 100644 index 0000000..f38e268 --- /dev/null +++ b/openstack-swift.logrotate @@ -0,0 +1,6 @@ +/var/log/swift/swift.log +{ + postrotate + /bin/kill -HUP `cat /var/run/syslogd.pid 2>/dev/null` 2>/dev/null || true + endscript +} diff --git a/openstack-swift.rsyslog b/openstack-swift.rsyslog new file mode 100644 index 0000000..12ba14b --- /dev/null +++ b/openstack-swift.rsyslog @@ -0,0 +1,5 @@ +# LOCAL0 is the upstream default and LOCAL2 is what Swift gets in +# RHOS and RDO if installed with Packstack (also, in docs). +# The breakout action prevents logging into /var/log/messages, bz#997983. +local0.*;local2.* /var/log/swift/swift.log +& ~ diff --git a/openstack-swift.spec b/openstack-swift.spec index 9e8cbbe..9533b73 100644 --- a/openstack-swift.spec +++ b/openstack-swift.spec @@ -7,7 +7,7 @@ Name: openstack-swift Version: 2.2.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: OpenStack Object Storage (Swift) Group: Development/Languages @@ -50,6 +50,8 @@ Source62: object-expirer.conf Source64: container-reconciler.conf Source20: %{name}.tmpfs Source7: swift.conf +Source71: %{name}.rsyslog +Source72: %{name}.logrotate ## Based at https://github.com/redhat-openstack/swift/ # @@ -243,9 +245,12 @@ install -d -m 755 %{buildroot}%{_localstatedir}/run/swift/account-server install -d -m 755 %{buildroot}%{_localstatedir}/run/swift/container-server install -d -m 755 %{buildroot}%{_localstatedir}/run/swift/object-server install -d -m 755 %{buildroot}%{_localstatedir}/run/swift/proxy-server +# syslog +install -d -m 755 %{buildroot}%{_localstatedir}/log/swift +install -p -D -m 644 %{SOURCE71} %{buildroot}%{_sysconfdir}/rsyslog.d/openstack-swift.conf +install -p -D -m 644 %{SOURCE72} %{buildroot}%{_sysconfdir}/logrotate.d/openstack-swift # Swift run directories -mkdir -p %{buildroot}%{_sysconfdir}/tmpfiles.d -install -p -m 0644 %{SOURCE20} %{buildroot}%{_sysconfdir}/tmpfiles.d/openstack-swift.conf +install -p -D -m 644 %{SOURCE20} %{buildroot}%{_sysconfdir}/tmpfiles.d/openstack-swift.conf # Install recon directory install -d -m 755 %{buildroot}%{_localstatedir}/cache/swift # Install home directory @@ -352,6 +357,9 @@ exit 0 %config(noreplace) %{_sysconfdir}/tmpfiles.d/openstack-swift.conf %dir %{_sysconfdir}/swift %config(noreplace) %attr(640, root, swift) %{_sysconfdir}/swift/swift.conf +%config(noreplace) %{_sysconfdir}/rsyslog.d/openstack-swift.conf +%config(noreplace) %{_sysconfdir}/logrotate.d/openstack-swift +%dir %{_localstatedir}/log/swift %dir %attr(0755, swift, root) %{_localstatedir}/run/swift %dir %attr(0755, swift, root) %{_localstatedir}/cache/swift %dir %attr(0755, swift, root) %{_sharedstatedir}/swift @@ -468,6 +476,9 @@ exit 0 %doc LICENSE doc/build/html %changelog +* Mon Oct 27 2014 Pete Zaitcev 2.2.0-2 +- Intercept logging to local0.* and local2.* (#997983) + * Sat Oct 18 2014 Alan Pevec 2.2.0-1 - Update to Juno release 2.2.0