[PATCH 2/2] Log: Add logrotate configuration file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In cman era corosync was depending on logrotate file distributed by
cman. It's good idea to logrotate also on systems without cman (new
clusters).

Signed-off-by: Jan Friesse <jfriesse@xxxxxxxxxx>
---
 conf/Makefile.am           |    2 +
 conf/logrotate/Makefile.am |   45 ++++++++++++++++++++++++++++++++++++++++++++
 conf/logrotate/corosync.in |    9 ++++++++
 configure.ac               |   17 +++++++++++++++-
 corosync.spec.in           |    1 +
 5 files changed, 73 insertions(+), 1 deletions(-)
 create mode 100644 conf/logrotate/Makefile.am
 create mode 100644 conf/logrotate/corosync.in

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

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss



[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux