From e75071a5eee1a69caac4d0477f5458ddfe776f07 Mon Sep 17 00:00:00 2001 From: "Bala.FA" Date: Fri, 9 Aug 2013 17:21:56 +0530 Subject: log: add rsyslog gluster configuration file This patch comes with rsyslog gluster configuration file for fedora and rhel >= 6. It disables syslog at rpm build time if targetted platform is rhel < 6 as there is no rsyslog support. Change-Id: I95c076874b6891ff08dee1b35980f95529fb0f37 BUG: 928648 Signed-off-by: Bala.FA Reviewed-on: http://review.gluster.org/5543 Reviewed-by: Vijay Bellur Tested-by: Gluster Build System --- extras/Makefile.am | 5 +++-- extras/gluster-rsyslog-5.8.conf | 15 +++++++++++++++ extras/gluster-rsyslog-7.2.conf | 42 +++++++++++++++++++++++++++++++++++++++++ glusterfs.spec.in | 30 +++++++++++++++++++++++++++++ 4 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 extras/gluster-rsyslog-5.8.conf create mode 100644 extras/gluster-rsyslog-7.2.conf diff --git a/extras/Makefile.am b/extras/Makefile.am index a49e8628c..2eb49aef3 100644 --- a/extras/Makefile.am +++ b/extras/Makefile.am @@ -5,10 +5,11 @@ EditorMode_DATA = glusterfs-mode.el glusterfs.vim SUBDIRS = init.d systemd benchmarking hook-scripts $(OCF_SUBDIR) LinuxRPM geo-rep confdir = $(sysconfdir)/glusterfs -conf_DATA = glusterfs-logrotate +conf_DATA = glusterfs-logrotate gluster-rsyslog-7.2.conf gluster-rsyslog-5.8.conf EXTRA_DIST = specgen.scm MacOSX/Portfile glusterfs-mode.el glusterfs.vim \ migrate-unify-to-distribute.sh backend-xattr-sanitize.sh \ backend-cleanup.sh disk_usage_sync.sh quota-remove-xattr.sh \ quota-metadata-cleanup.sh glusterfs-logrotate clear_xattrs.sh \ - group-virt.example glusterd-sysconfig + group-virt.example glusterd-sysconfig gluster-rsyslog-7.2.conf \ + gluster-rsyslog-5.8.conf diff --git a/extras/gluster-rsyslog-5.8.conf b/extras/gluster-rsyslog-5.8.conf new file mode 100644 index 000000000..da6232bc0 --- /dev/null +++ b/extras/gluster-rsyslog-5.8.conf @@ -0,0 +1,15 @@ +##### gluster.conf ##### +$RepeatedMsgReduction on + +$ModLoad mmcount +$mmcountKey gf_code + +$template Glusterfsd_dynLogFile,"/var/log/glusterfs/bricks/%app-name%.log" +$template Gluster_dynLogFile,"/var/log/glusterfs/%app-name%.log" + +$template GLFS_Template,"%msgid%/%syslogfacility-text:::uppercase%/%syslogseverity-text:::uppercase% [%TIMESTAMP:::date-rfc3339%] %msg:::sp-if-no-1st-sp%%msg:::drop-last-lf%\n" + +if $app-name contains 'gluster' then :mmcount: +if $app-name contains 'glusterfsd' then ?Glusterfsd_dynLogFile;GLFS_Template +if $app-name contains 'gluster' and not ( $app-name contains 'glusterfsd' ) then ?Gluster_dynLogFile;GLFS_Template +if $app-name contains 'gluster' then ~ diff --git a/extras/gluster-rsyslog-7.2.conf b/extras/gluster-rsyslog-7.2.conf new file mode 100644 index 000000000..744acbc9e --- /dev/null +++ b/extras/gluster-rsyslog-7.2.conf @@ -0,0 +1,42 @@ +##### gluster.conf ##### +$RepeatedMsgReduction on + +$ModLoad mmjsonparse +*.* :mmjsonparse: + +template (name="Glusterfsd_dynLogFile" type="string" string="/var/log/glusterfs/bricks/%app-name%.log") +template (name="Gluster_dynLogFile" type="string" string="/var/log/glusterfs/%app-name%.log") + +template(name="GLFS_template" type="list") { + property(name="$!mmcount") + constant(value="/") + property(name="syslogfacility-text" caseConversion="upper") + constant(value="/") + property(name="syslogseverity-text" caseConversion="upper") + constant(value=" ") + constant(value="[") + property(name="timereported" dateFormat="rfc3339") + constant(value="] ") + constant(value="[") + property(name="$!gf_code") + constant(value="] ") + constant(value="[") + property(name="$!gf_message") + constant(value="] ") + property(name="$!msg") + constant(value="\n") +} + +if $app-name contains 'glusterfsd' then { + action(type="omfile" + DynaFile="Glusterfsd_dynLogFile" + Template="GLFS_template") + stop +} + +if $app-name contains 'gluster' then { + action(type="omfile" + DynaFile="Gluster_dynLogFile" + Template="GLFS_template") + stop +} diff --git a/glusterfs.spec.in b/glusterfs.spec.in index c2ef6d147..9308a641f 100644 --- a/glusterfs.spec.in +++ b/glusterfs.spec.in @@ -35,6 +35,11 @@ # rpmbuild -ta @PACKAGE_NAME@-@PACKAGE_VERSION@tar.gz --without syslog %{?_without_syslog:%global _without_syslog --disable-syslog} +# disable syslog forcefully as rhel < 6 doesn't have rsyslog +%if ( 0%{?rhel} && 0%{?rhel} < 6 ) +%global _without_syslog --disable-syslog +%endif + # there is no systemtap support! Perhaps some day there will be %global _without_systemtap --enable-systemtap=no @@ -175,6 +180,12 @@ both GlusterFS server and client framework. %package libs Summary: GlusterFS common libraries Group: Applications/File +%if ( 0%{?fedora} ) || ( 0%{?rhel} && 0%{?rhel} > 6 ) +Requires: rsyslog-mmjsonparse +%endif +%if ( 0%{?rhel} && 0%{?rhel} == 6 ) +Requires: rsyslog-mmcount +%endif %description libs GlusterFS is a clustered file-system capable of scaling to several @@ -485,6 +496,16 @@ sed -i 's|option working-directory /etc/glusterd|option working-directory %{_sha touch %{buildroot}%{_sharedstatedir}/glusterd/geo-replication/gsyncd_template.conf %endif +%if ( 0%{?fedora} ) || ( 0%{?rhel} && 0%{?rhel} > 6 ) +%{__install} -D -p -m 0644 extras/gluster-rsyslog-7.2.conf \ + %{buildroot}%{_sysconfdir}/rsyslog.d/gluster.conf +%endif + +%if ( 0%{?rhel} && 0%{?rhel} == 6 ) +%{__install} -D -p -m 0644 extras/gluster-rsyslog-5.8.conf \ + %{buildroot}%{_sysconfdir}/rsyslog.d/gluster.conf +%endif + # the rest of the ghosts touch %{buildroot}%{_sharedstatedir}/glusterd/glusterd.info touch %{buildroot}%{_sharedstatedir}/glusterd/options @@ -564,12 +585,21 @@ touch %{buildroot}%{_sharedstatedir}/glusterd/nfs/run/nfs.pid %post libs /sbin/ldconfig +%if ( 0%{?fedora} ) || ( 0%{?rhel} && 0%{?rhel} >= 6 ) +%_init_restart rsyslog +%endif %postun libs /sbin/ldconfig +%if ( 0%{?fedora} ) || ( 0%{?rhel} && 0%{?rhel} >= 6 ) +%_init_restart rsyslog +%endif %files libs %{_libdir}/*.so.* +%if ( 0%{?fedora} ) || ( 0%{?rhel} && 0%{?rhel} >= 6 ) +%{_sysconfdir}/rsyslog.d/gluster.conf +%endif %exclude %{_libdir}/libgfapi.* %files cli -- cgit