
On Thu, 2016-01-14 at 15:13 -0200, Ramon Medeiros wrote:
Use logrotate to compress and keep 10 logs of 1MB If i get it right after 10mb of log files, the log files will start getting overwritten?
If that is the case, just a curious thought, we will start loosing the logs if the entries not happen in 10MB. Say customer is doing high activities that lead to log full quickly, then we might loose the debug log that might have useful data. Can we have something like once these 10 files are written, zip them and create a tar files say log1.tar till log5.tar. Which means we will have 10MB * 5 =50mb of log files. We had this experience in AIX, and we were forced to store more debug data.
Signed-off-by: Ramon Medeiros <ramonn@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/ + $(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 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 +} +