Browse Source

Log: Add logrotate configuration file

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@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Jan Friesse 10 years ago
parent
commit
aabbace625
5 changed files with 73 additions and 1 deletions
  1. 2 0
      conf/Makefile.am
  2. 45 0
      conf/logrotate/Makefile.am
  3. 9 0
      conf/logrotate/corosync.in
  4. 16 1
      configure.ac
  5. 1 0
      corosync.spec.in

+ 2 - 0
conf/Makefile.am

@@ -69,3 +69,5 @@ if INSTALL_DBUSCONF
 dbusdir			= $(sysconfdir)/dbus-1/system.d
 dbusdir			= $(sysconfdir)/dbus-1/system.d
 dbus_DATA		= corosync-signals.conf
 dbus_DATA		= corosync-signals.conf
 endif
 endif
+
+SUBDIRS = logrotate

+ 45 - 0
conf/logrotate/Makefile.am

@@ -0,0 +1,45 @@
+# Copyright (c) 2009 Red Hat, Inc.
+#
+# Authors:Jan Friesse (jfriesse@redhat.com)
+#         Andrew Beekhof
+#         Steven Dake (sdake@redhat.com)
+#
+# 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

+ 9 - 0
conf/logrotate/corosync.in

@@ -0,0 +1,9 @@
+@LOGDIR@/corosync.log {
+	missingok
+	compress
+	copytruncate
+	daily
+	rotate 31
+	minsize 2048
+	notifempty
+}

+ 16 - 1
configure.ac

@@ -199,7 +199,8 @@ AC_CONFIG_FILES([Makefile
 		 tools/Makefile
 		 tools/Makefile
 		 conf/Makefile
 		 conf/Makefile
 		 qdevices/Makefile
 		 qdevices/Makefile
-		 Doxyfile])
+		 Doxyfile
+		 conf/logrotate/Makefile])
 
 
 ### Local business
 ### Local business
 
 
@@ -369,6 +370,16 @@ AC_ARG_WITH([initwrappersdir],
 	[ INITWRAPPERSDIR="$withval" ],
 	[ INITWRAPPERSDIR="$withval" ],
 	[ INITWRAPPERSDIR="$datarootdir/corosync" ])
 	[ 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],
 AC_ARG_ENABLE([snmp],
 	[  --enable-snmp                   : SNMP protocol support ],
 	[  --enable-snmp                   : SNMP protocol support ],
 	[ default="no" ])
 	[ default="no" ])
@@ -674,6 +685,8 @@ AC_SUBST([SYSTEMDDIR])
 AC_SUBST([UPSTARTDIR])
 AC_SUBST([UPSTARTDIR])
 INITWRAPPERSDIR=$(eval echo ${INITWRAPPERSDIR})
 INITWRAPPERSDIR=$(eval echo ${INITWRAPPERSDIR})
 AC_SUBST([INITWRAPPERSDIR])
 AC_SUBST([INITWRAPPERSDIR])
+AC_SUBST([LOGDIR])
+AC_SUBST([LOGROTATEDIR])
 
 
 AC_SUBST([SOMAJOR])
 AC_SUBST([SOMAJOR])
 AC_SUBST([SOMINOR])
 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 systemd directory = ${SYSTEMDDIR}])
 AC_MSG_RESULT([  System upstart directory = ${UPSTARTDIR}])
 AC_MSG_RESULT([  System upstart directory = ${UPSTARTDIR}])
 AC_MSG_RESULT([  System init wraps dir    = ${INITWRAPPERSDIR}])
 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([  corosync config dir      = ${COROSYSCONFDIR}])
 AC_MSG_RESULT([  Features                 =${PACKAGE_FEATURES}])
 AC_MSG_RESULT([  Features                 =${PACKAGE_FEATURES}])
 AC_MSG_RESULT([])
 AC_MSG_RESULT([])

+ 1 - 0
corosync.spec.in

@@ -196,6 +196,7 @@ fi
 %config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example.udpu
 %config(noreplace) %{_sysconfdir}/corosync/corosync.conf.example.udpu
 %config(noreplace) %{_sysconfdir}/sysconfig/corosync-notifyd
 %config(noreplace) %{_sysconfdir}/sysconfig/corosync-notifyd
 %config(noreplace) %{_sysconfdir}/sysconfig/corosync
 %config(noreplace) %{_sysconfdir}/sysconfig/corosync
+%config(noreplace) %{_sysconfdir}/logrotate.d/corosync
 %if %{with dbus}
 %if %{with dbus}
 %{_sysconfdir}/dbus-1/system.d/corosync-signals.conf
 %{_sysconfdir}/dbus-1/system.d/corosync-signals.conf
 %endif
 %endif