summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extras/Makefile.am5
-rw-r--r--extras/glusterfs-georep-logrotate18
-rw-r--r--geo-replication/syncdaemon/gsyncd.py21
-rw-r--r--geo-replication/syncdaemon/monitor.py13
-rw-r--r--glusterfs.spec.in2
5 files changed, 42 insertions, 17 deletions
diff --git a/extras/Makefile.am b/extras/Makefile.am
index 1ccd9dbd9bf..cf619329b75 100644
--- a/extras/Makefile.am
+++ b/extras/Makefile.am
@@ -6,7 +6,7 @@ SUBDIRS = init.d systemd benchmarking hook-scripts $(OCF_SUBDIR) LinuxRPM geo-re
confdir = $(sysconfdir)/glusterfs
conf_DATA = glusterfs-logrotate gluster-rsyslog-7.2.conf gluster-rsyslog-5.8.conf \
- logger.conf.example
+ logger.conf.example glusterfs-georep-logrotate
voldir = $(sysconfdir)/glusterfs
vol_DATA = glusterd.vol
@@ -16,4 +16,5 @@ EXTRA_DIST = specgen.scm MacOSX/Portfile glusterfs-mode.el glusterfs.vim \
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 gluster-rsyslog-7.2.conf \
- gluster-rsyslog-5.8.conf logger.conf.example glusterd.vol
+ gluster-rsyslog-5.8.conf logger.conf.example glusterd.vol \
+ glusterfs-georep-logrotate
diff --git a/extras/glusterfs-georep-logrotate b/extras/glusterfs-georep-logrotate
new file mode 100644
index 00000000000..6a69ab1e35a
--- /dev/null
+++ b/extras/glusterfs-georep-logrotate
@@ -0,0 +1,18 @@
+
+rotate 52
+missingok
+
+compress
+delaycompress
+notifempty
+
+/var/log/glusterfs/geo-replication/*/*.log {
+}
+
+
+/var/log/glusterfs/geo-replication-slaves/*.log {
+}
+
+
+/var/log/glusterfs/geo-replication-slaves/*/*.log {
+}
diff --git a/geo-replication/syncdaemon/gsyncd.py b/geo-replication/syncdaemon/gsyncd.py
index b460c6c6dbc..7fcc3165ac9 100644
--- a/geo-replication/syncdaemon/gsyncd.py
+++ b/geo-replication/syncdaemon/gsyncd.py
@@ -12,7 +12,7 @@ import optparse
import fcntl
import fnmatch
from optparse import OptionParser, SUPPRESS_HELP
-from logging import Logger
+from logging import Logger, handlers
from errno import EEXIST, ENOENT
from ipaddr import IPAddress, IPNetwork
@@ -58,7 +58,24 @@ class GLogger(Logger):
logging.root = cls("root", lvl)
logging.setLoggerClass(cls)
logging.getLogger().handlers = []
- logging.basicConfig(**lprm)
+ logging.getLogger().setLevel(lprm['level'])
+
+ if 'filename' in lprm:
+ try:
+ logging_handler = handlers.WatchedFileHandler(lprm['filename'])
+ formatter = logging.Formatter(fmt=lprm['format'],
+ datefmt=lprm['datefmt'])
+ logging_handler.setFormatter(formatter)
+ logging.getLogger().addHandler(logging_handler)
+ except AttributeError:
+ # Python version < 2.6 will not have WatchedFileHandler
+ # so fallback to logging without any handler.
+ # Note: logrotate will not work if Python version is < 2.6
+ logging.basicConfig(**lprm)
+ else:
+ # If filename not passed(not available in lprm) then it may be
+ # streaming.(Ex: {"stream": "/dev/stdout"})
+ logging.basicConfig(**lprm)
@classmethod
def _gsyncd_loginit(cls, **kw):
diff --git a/geo-replication/syncdaemon/monitor.py b/geo-replication/syncdaemon/monitor.py
index f6c79753d35..0c3a42fa6b7 100644
--- a/geo-replication/syncdaemon/monitor.py
+++ b/geo-replication/syncdaemon/monitor.py
@@ -176,19 +176,6 @@ class Monitor(object):
return ret
def multiplex(self, wspx, suuid):
- def sigcont_handler(*a):
- """
- Re-init logging and send group kill signal
- """
- md = gconf.log_metadata
- logging.shutdown()
- lcls = logging.getLoggerClass()
- lcls.setup(label=md.get('saved_label'), **md)
- pid = os.getpid()
- os.kill(-pid, signal.SIGUSR1)
- signal.signal(signal.SIGUSR1, lambda *a: ())
- signal.signal(signal.SIGCONT, sigcont_handler)
-
argv = sys.argv[:]
for o in ('-N', '--no-daemon', '--monitor'):
while o in argv:
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index 8940fdc0fed..c59a159bdc6 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -545,6 +545,8 @@ sed -i 's|option working-directory /etc/glusterd|option working-directory %{_sha
# geo-rep ghosts
%{__mkdir_p} %{buildroot}%{_sharedstatedir}/glusterd/geo-replication
touch %{buildroot}%{_sharedstatedir}/glusterd/geo-replication/gsyncd_template.conf
+%{__install} -D -p -m 0644 extras/glusterfs-georep-logrotate \
+ %{buildroot}%{_sysconfdir}/logrotate.d/glusterfs-georep
%endif
%if ( 0%{!?_without_syslog:1} )