From bdf20a205a4d67d5f6d3ac6010a34291c2822a80 Mon Sep 17 00:00:00 2001 From: Venky Shankar Date: Wed, 28 Sep 2011 16:38:00 +0530 Subject: cli: add geo-replication log-rotate command Rotating geo-replication master/monitor log files from cli. On invocation, the log file for a given master-slave session is backed up with the current timestamp suffixed to the file name and signal is sent to gsyncd to start logging to a new log file. Sample commands: * Rotate log file for this : session: gluster volume geo-replication log-rotate * Rotate log files for all session for master volume gluster volume geo-replication log-rotate * Rotate log files for all sessions: gluster volume geo-replication log-rotate Change-Id: I75f641b4e082a04d5373c18583ca4a1d9651d27a BUG: 3519 Reviewed-on: http://review.gluster.com/529 Tested-by: Gluster Build System Reviewed-by: Csaba Henk --- xlators/features/marker/utils/syncdaemon/gsyncd.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'xlators/features/marker/utils/syncdaemon/gsyncd.py') diff --git a/xlators/features/marker/utils/syncdaemon/gsyncd.py b/xlators/features/marker/utils/syncdaemon/gsyncd.py index 67a873cb57c..2b8356b1620 100644 --- a/xlators/features/marker/utils/syncdaemon/gsyncd.py +++ b/xlators/features/marker/utils/syncdaemon/gsyncd.py @@ -6,7 +6,6 @@ import sys import time import logging import signal -import select import optparse import fcntl import fnmatch @@ -18,7 +17,7 @@ from ipaddr import IPAddress, IPNetwork from gconf import gconf from syncdutils import FreeObject, norm, grabpidfile, finalize, log_raise_exception -from syncdutils import GsyncdError +from syncdutils import GsyncdError, select from configinterface import GConffile import resource from monitor import monitor @@ -59,7 +58,6 @@ class GLogger(Logger): logging.getLogger().handlers = [] logging.basicConfig(**lprm) - def startup(**kw): """set up logging, pidfile grabbing, daemonization""" if getattr(gconf, 'pid_file', None) and kw.get('go_daemon') != 'postconn': @@ -87,7 +85,7 @@ def startup(**kw): # so we can start up with # no messing from the dirty # ol' bustard - select.select((x,), (), ()) + select((x,), (), ()) os.close(x) lkw = {} @@ -100,7 +98,11 @@ def startup(**kw): lkw['stream'] = sys.stdout else: lkw['filename'] = kw['log_file'] + GLogger.setup(label=kw.get('label'), **lkw) + + lkw.update({'saved_label': kw.get('label')}) + gconf.log_metadata = lkw gconf.log_exit = True def main(): -- cgit