diff --git a/configure.ac b/configure.ac index fcce9b1..e95e85c 100644 --- a/configure.ac +++ b/configure.ac @@ -118,6 +118,9 @@ fi GLUSTER_BLOCKD_LIBEXECDIR="$(eval echo ${libexecdir}/gluster-block)" AC_SUBST(GLUSTER_BLOCKD_LIBEXECDIR) +GLUSTER_BLOCKD_LOGROTATEDIR="$(eval echo /etc/logrotate.d)" +AC_SUBST(GLUSTER_BLOCKD_LOGROTATEDIR) + # Checks for typedefs, structures, and compiler characteristics. AC_CHECK_HEADER_STDBOOL AC_TYPE_SIZE_T diff --git a/gluster-block.spec.in b/gluster-block.spec.in index d89e2f1..4e28d11 100644 --- a/gluster-block.spec.in +++ b/gluster-block.spec.in @@ -81,6 +81,7 @@ rm -rf ${RPM_BUILD_ROOT} %attr(0755,-,-) %{_initddir}/gluster-blockd %endif %config(noreplace) %{_sysconfdir}/sysconfig/gluster-blockd +%config(noreplace) %{_sysconfdir}/logrotate.d/gluster-block %dir %attr(0755,-,-) %{_libexecdir}/gluster-block %attr(0755,-,-) %{_libexecdir}/gluster-block/wait-for-bricks.sh %attr(0755,-,-) %{_libexecdir}/gluster-block/upgrade_activities.sh diff --git a/systemd/Makefile.am b/systemd/Makefile.am index 798b4a8..939fa73 100644 --- a/systemd/Makefile.am +++ b/systemd/Makefile.am @@ -18,7 +18,11 @@ endif install-data-local: $(MKDIR_P) $(DESTDIR)${sysconfigdir}; \ $(INSTALL_DATA) gluster-blockd.sysconfig \ - $(DESTDIR)${sysconfigdir}/gluster-blockd; + $(DESTDIR)${sysconfigdir}/gluster-blockd; \ + $(MKDIR_P) $(DESTDIR)$(GLUSTER_BLOCKD_LOGROTATEDIR);\ + $(INSTALL_DATA) -m 644 gluster-block.logrotate \ + $(DESTDIR)$(GLUSTER_BLOCKD_LOGROTATEDIR)/gluster-block; uninstall-local: - rm -f $(DESTDIR)${sysconfigdir}/gluster-blockd + rm -f $(DESTDIR)${sysconfigdir}/gluster-blockd \ + $(DESTDIR)$(GLUSTER_BLOCKD_LOGROTATEDIR)/gluster-block diff --git a/systemd/gluster-block.logrotate b/systemd/gluster-block.logrotate new file mode 100644 index 0000000..2b03a14 --- /dev/null +++ b/systemd/gluster-block.logrotate @@ -0,0 +1,18 @@ +# Rotate all the gluster-block logs +/var/log/gluster-block/*.log { + sharedscripts + weekly + maxsize 10M + minsize 100k + +# 6 months of logs are good enough + rotate 26 + + missingok + compress + delaycompress + notifempty + postrotate + killall -q -s 1 gluster-blockd > /dev/null 2>&1 || true + endscript +}