On 01/14/2016 03:13 PM, Ramon Medeiros wrote:
Use logrotate to compress and keep 10 logs of 1MB
Signed-off-by: Ramon Medeiros <ramonn(a)linux.vnet.ibm.com>
---
Makefile.am | 2 ++
contrib/Makefile.am | 1 +
contrib/wok.spec.fedora.in | 1 +
contrib/wok.spec.suse.in | 1 +
contrib/wokd.logrotate | 30 ++++++++++++++++++++++++++++++
5 files changed, 35 insertions(+)
create mode 100644 contrib/wokd.logrotate
diff --git a/Makefile.am b/Makefile.am
index 278bda1..6d4c574 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -140,6 +140,8 @@ install-data-local:
mkdir -p $(DESTDIR)/etc/wok/
$(INSTALL_DATA) src/dhparams.pem $(DESTDIR)/etc/wok/dhparams.pem
touch $(DESTDIR)/etc/nginx/conf.d/wok.conf
+ mkdir -p $(DESTDIR)/etc/logrotate.d/
Is really necessary create the /etc/logrotate.d directory? I suppose you
are adding a new configuration to the logrotate, right? So, if I already
have logrotate installed in this box, this line is not necessary.
In addition, I guess you should add the package logrotate as runtime
dependency for all distros.
+ $(INSTALL_DATA) $(top_srcdir)/contrib/wokd.logrotate
$(DESTDIR)/etc/logrotate.d/wokd
uninstall-local:
@if test -f $(systemdsystemunitdir)/wokd.service; then \
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index ed4a006..2939bc9 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -29,6 +29,7 @@ EXTRA_DIST = \
wokd-upstart.conf.debian \
wokd-upstart.conf.fedora \
make-deb.sh.in \
+ wokd.logrotate \
$(NULL)
make-deb.sh: make-deb.sh.in $(top_builddir)/config.status
diff --git a/contrib/wok.spec.fedora.in b/contrib/wok.spec.fedora.in
index 34b3ac3..feea7f1 100644
--- a/contrib/wok.spec.fedora.in
+++ b/contrib/wok.spec.fedora.in
@@ -116,6 +116,7 @@ rm -rf $RPM_BUILD_ROOT
%{_sysconfdir}/nginx/conf.d/wok.conf.in
%{_sysconfdir}/wok/wok.conf
%{_sysconfdir}/wok/
+%{_sysconfdir}/logrotate.d/wokd
%{_mandir}/man8/wokd.8.gz
%if 0%{?with_systemd}
diff --git a/contrib/wok.spec.suse.in b/contrib/wok.spec.suse.in
index aab4a80..fa477e1 100644
--- a/contrib/wok.spec.suse.in
+++ b/contrib/wok.spec.suse.in
@@ -93,6 +93,7 @@ rm -rf $RPM_BUILD_ROOT
%{_sysconfdir}/wok/
%{_sysconfdir}/nginx/conf.d/wok.conf.in
%{_sysconfdir}/nginx/conf.d/wok.conf
+%{_sysconfdir}/logrotate.d/wokd
%{_var}/lib/wok/
%{_localstatedir}/log/wok/*
%{_localstatedir}/log/wok/
diff --git a/contrib/wokd.logrotate b/contrib/wokd.logrotate
new file mode 100644
index 0000000..2a03106
--- /dev/null
+++ b/contrib/wokd.logrotate
@@ -0,0 +1,30 @@
+#
+# Project Wok
+#
+# Copyright IBM Corp, 2016
+#
+# Code derived from Project Kimchi
This code is not derived from Project Kimchi :-P
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+/var/log/wok/*log {
+ daily
+ maxsize 1024k
+ rotate 10
+ missingok
+ compress
+ sharedscripts
+}
+