Blame SOURCES/bz1225441-1-Log-Add-logrotate-configuration-file.patch

f1cb04
From aabbace625b3c68332b4356887378fca81f8f387 Mon Sep 17 00:00:00 2001
f1cb04
From: Jan Friesse <jfriesse@redhat.com>
f1cb04
Date: Fri, 19 Jun 2015 17:42:09 +0200
f1cb04
Subject: [PATCH] Log: Add logrotate configuration file
f1cb04
f1cb04
In cman era corosync was depending on logrotate file distributed by
f1cb04
cman. It's good idea to logrotate also on systems without cman (new
f1cb04
clusters).
f1cb04
f1cb04
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
f1cb04
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
f1cb04
---
f1cb04
 conf/Makefile.am           |    2 +
f1cb04
 conf/logrotate/Makefile.am |   45 ++++++++++++++++++++++++++++++++++++++++++++
f1cb04
 conf/logrotate/corosync.in |    9 ++++++++
f1cb04
 configure.ac               |   17 +++++++++++++++-
f1cb04
 corosync.spec.in           |    1 +
f1cb04
 5 files changed, 73 insertions(+), 1 deletions(-)
f1cb04
 create mode 100644 conf/logrotate/Makefile.am
f1cb04
 create mode 100644 conf/logrotate/corosync.in
f1cb04
f1cb04
diff --git a/conf/Makefile.am b/conf/Makefile.am
f1cb04
index 69f7ff9..807b6cc 100644
f1cb04
--- a/conf/Makefile.am
f1cb04
+++ b/conf/Makefile.am
f1cb04
@@ -69,3 +69,5 @@ if INSTALL_DBUSCONF
f1cb04
 dbusdir			= $(sysconfdir)/dbus-1/system.d
f1cb04
 dbus_DATA		= corosync-signals.conf
f1cb04
 endif
f1cb04
+
f1cb04
+SUBDIRS = logrotate
f1cb04
diff --git a/conf/logrotate/Makefile.am b/conf/logrotate/Makefile.am
f1cb04
new file mode 100644
f1cb04
index 0000000..a22079b
f1cb04
--- /dev/null
f1cb04
+++ b/conf/logrotate/Makefile.am
f1cb04
@@ -0,0 +1,45 @@
f1cb04
+# Copyright (c) 2009 Red Hat, Inc.
f1cb04
+#
f1cb04
+# Authors:Jan Friesse (jfriesse@redhat.com)
f1cb04
+#         Andrew Beekhof
f1cb04
+#         Steven Dake (sdake@redhat.com)
f1cb04
+#
f1cb04
+# This software licensed under BSD license, the text of which follows:
f1cb04
+#
f1cb04
+# Redistribution and use in source and binary forms, with or without
f1cb04
+# modification, are permitted provided that the following conditions are met:
f1cb04
+#
f1cb04
+# - Redistributions of source code must retain the above copyright notice,
f1cb04
+#   this list of conditions and the following disclaimer.
f1cb04
+# - Redistributions in binary form must reproduce the above copyright notice,
f1cb04
+#   this list of conditions and the following disclaimer in the documentation
f1cb04
+#   and/or other materials provided with the distribution.
f1cb04
+# - Neither the name of the MontaVista Software, Inc. nor the names of its
f1cb04
+#   contributors may be used to endorse or promote products derived from this
f1cb04
+#   software without specific prior written permission.
f1cb04
+#
f1cb04
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
f1cb04
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
f1cb04
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
f1cb04
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
f1cb04
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
f1cb04
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
f1cb04
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
f1cb04
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
f1cb04
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
f1cb04
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
f1cb04
+# THE POSSIBILITY OF SUCH DAMAGE.
f1cb04
+
f1cb04
+MAINTAINERCLEANFILES    = Makefile.in
f1cb04
+
f1cb04
+EXTRA_DIST		= corosync.in
f1cb04
+
f1cb04
+corosync: corosync.in
f1cb04
+	sed -e 's#@''LOGDIR@#${LOGDIR}#g' \
f1cb04
+	    $< > $@
f1cb04
+
f1cb04
+logrotatecorosyncdir    = ${LOGROTATEDIR}
f1cb04
+logrotatecorosync_DATA  = corosync
f1cb04
+
f1cb04
+clean-local:
f1cb04
+	rm -f corosync
f1cb04
diff --git a/conf/logrotate/corosync.in b/conf/logrotate/corosync.in
f1cb04
new file mode 100644
f1cb04
index 0000000..cba17b0
f1cb04
--- /dev/null
f1cb04
+++ b/conf/logrotate/corosync.in
f1cb04
@@ -0,0 +1,9 @@
f1cb04
+@LOGDIR@/corosync.log {
f1cb04
+	missingok
f1cb04
+	compress
f1cb04
+	copytruncate
f1cb04
+	daily
f1cb04
+	rotate 31
f1cb04
+	minsize 2048
f1cb04
+	notifempty
f1cb04
+}
f1cb04
diff --git a/configure.ac b/configure.ac
f1cb04
index b394329..4b640fc 100644
f1cb04
--- a/configure.ac
f1cb04
+++ b/configure.ac
f1cb04
@@ -199,7 +199,8 @@ AC_CONFIG_FILES([Makefile
f1cb04
 		 tools/Makefile
f1cb04
 		 conf/Makefile
f1cb04
 		 qdevices/Makefile
f1cb04
-		 Doxyfile])
f1cb04
+		 Doxyfile
f1cb04
+		 conf/logrotate/Makefile])
f1cb04
 
f1cb04
 ### Local business
f1cb04
 
f1cb04
@@ -369,6 +370,16 @@ AC_ARG_WITH([initwrappersdir],
f1cb04
 	[ INITWRAPPERSDIR="$withval" ],
f1cb04
 	[ INITWRAPPERSDIR="$datarootdir/corosync" ])
f1cb04
 
f1cb04
+AC_ARG_WITH([logdir],
f1cb04
+	[  --logdir=DIR   : the base directory for corosync logging files. ],
f1cb04
+	[ LOGDIR="$withval" ],
f1cb04
+	[ LOGDIR="$localstatedir/log/cluster" ])
f1cb04
+
f1cb04
+AC_ARG_WITH([logrotatedir],
f1cb04
+	[  --logrotatedir=DIR   : the base directory for logrorate.d files.  ],
f1cb04
+	[ LOGROTATEDIR="$withval" ],
f1cb04
+	[ LOGROTATEDIR="$sysconfdir/logrotate.d" ])
f1cb04
+
f1cb04
 AC_ARG_ENABLE([snmp],
f1cb04
 	[  --enable-snmp                   : SNMP protocol support ],
f1cb04
 	[ default="no" ])
f1cb04
@@ -674,6 +685,8 @@ AC_SUBST([SYSTEMDDIR])
f1cb04
 AC_SUBST([UPSTARTDIR])
f1cb04
 INITWRAPPERSDIR=$(eval echo ${INITWRAPPERSDIR})
f1cb04
 AC_SUBST([INITWRAPPERSDIR])
f1cb04
+AC_SUBST([LOGDIR])
f1cb04
+AC_SUBST([LOGROTATEDIR])
f1cb04
 
f1cb04
 AC_SUBST([SOMAJOR])
f1cb04
 AC_SUBST([SOMINOR])
f1cb04
@@ -716,6 +729,8 @@ AC_MSG_RESULT([  System init.d directory  = ${INITDDIR}])
f1cb04
 AC_MSG_RESULT([  System systemd directory = ${SYSTEMDDIR}])
f1cb04
 AC_MSG_RESULT([  System upstart directory = ${UPSTARTDIR}])
f1cb04
 AC_MSG_RESULT([  System init wraps dir    = ${INITWRAPPERSDIR}])
f1cb04
+AC_MSG_RESULT([  Log directory            = ${LOGDIR}])
f1cb04
+AC_MSG_RESULT([  Log rotate directory     = ${LOGROTATEDIR}])
f1cb04
 AC_MSG_RESULT([  corosync config dir      = ${COROSYSCONFDIR}])
f1cb04
 AC_MSG_RESULT([  Features                 =${PACKAGE_FEATURES}])
f1cb04
 AC_MSG_RESULT([])
f1cb04
diff --git a/corosync.spec.in b/corosync.spec.in
f1cb04
index a2ba584..12979f6 100644
f1cb04
--- a/corosync.spec.in
f1cb04
+++ b/corosync.spec.in
f1cb04
@@ -196,6 +196,7 @@ fi
f1cb04
 %config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example.udpu
f1cb04
 %config(noreplace) %{_sysconfdir}/sysconfig/corosync-notifyd
f1cb04
 %config(noreplace) %{_sysconfdir}/sysconfig/corosync
f1cb04
+%config(noreplace) %{_sysconfdir}/logrotate.d/corosync
f1cb04
 %if %{with dbus}
f1cb04
 %{_sysconfdir}/dbus-1/system.d/corosync-signals.conf
f1cb04
 %endif
f1cb04
-- 
f1cb04
1.7.1
f1cb04