From 4ae3853d857e584189289b33f8ba929fbd9cc7e1 Mon Sep 17 00:00:00 2001 From: shishir gowda Date: Tue, 31 Aug 2010 04:10:17 +0000 Subject: Add command logging facility for glusterd Added new command logging facility to gf_cmd_log() which can be used to log all commands to a .cmd_log_history file situated in the glusterd working directory. Accepts 1 st argument a domain string (e.g: volume, peer..) followed by msg string (similar to gf_log) Signed-off-by: shishir gowda Signed-off-by: Vijay Bellur BUG: 1404 (need a dump of all the op/mgmt commands) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1404 --- xlators/mgmt/glusterd/src/glusterd.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'xlators') diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c index d23f06190d7..a038bc69817 100644 --- a/xlators/mgmt/glusterd/src/glusterd.c +++ b/xlators/mgmt/glusterd/src/glusterd.c @@ -232,7 +232,7 @@ init (xlator_t *this) int port_num = 0; char voldir [PATH_MAX] = {0,}; char dirname [PATH_MAX]; - + char cmd_log_filename [PATH_MAX] = {0,}; dir_data = dict_get (this->options, "working-directory"); @@ -273,6 +273,15 @@ init (xlator_t *this) gf_log (this->name, GF_LOG_NORMAL, "Using %s as working directory", dirname); + snprintf (cmd_log_filename, PATH_MAX,"%s/.cmd_log_history",dirname); + ret = gf_cmd_log_init (cmd_log_filename); + + if (ret == -1) { + gf_log ("this->name", GF_LOG_CRITICAL, + "Unable to create cmd log file %s", cmd_log_filename); + exit (1); + } + snprintf (voldir, PATH_MAX, "%s/vols", dirname); ret = mkdir (voldir, 0777); -- cgit