summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2014-03-11 15:05:44 +0530
committerVijay Bellur <vbellur@redhat.com>2014-04-11 18:00:54 -0700
commit712541cdefcc9614e5a79f628358f205ceda6e55 (patch)
treed2ba17083d16f1cacc80c7498ba0534d7ef16baf /xlators/mgmt/glusterd/src
parente73af16885f6d11ebcb225edb4d12214ceeba74c (diff)
logging: Make logger and log format configurable through cli
Change-Id: Ic4b701a6621578848ff67ae4ecb5a10b5f32f93b BUG: 1075611 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: http://review.gluster.org/7372 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c87
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-set.c22
2 files changed, 103 insertions, 6 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 7839582..0b3a8d0 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -1328,6 +1328,44 @@ sys_loglevel_option_handler (volgen_graph_t *graph,
}
static int
+logger_option_handler (volgen_graph_t *graph, struct volopt_map_entry *vme,
+ void *param)
+{
+ char *role = NULL;
+ struct volopt_map_entry vme2 = {0,};
+
+ role = (char *) param;
+
+ if (strcmp (vme->option, "!logger") != 0 ||
+ !strstr (vme->key, role))
+ return 0;
+
+ memcpy (&vme2, vme, sizeof (vme2));
+ vme2.option = "logger";
+
+ return basic_option_handler (graph, &vme2, NULL);
+}
+
+static int
+log_format_option_handler (volgen_graph_t *graph, struct volopt_map_entry *vme,
+ void *param)
+{
+ char *role = NULL;
+ struct volopt_map_entry vme2 = {0,};
+
+ role = (char *) param;
+
+ if (strcmp (vme->option, "!log-format") != 0 ||
+ !strstr (vme->key, role))
+ return 0;
+
+ memcpy (&vme2, vme, sizeof (vme2));
+ vme2.option = "log-format";
+
+ return basic_option_handler (graph, &vme2, NULL);
+}
+
+static int
volgen_graph_set_xl_options (volgen_graph_t *graph, dict_t *dict)
{
int32_t ret = -1;
@@ -1379,6 +1417,12 @@ server_spec_option_handler (volgen_graph_t *graph,
if (!ret)
ret = sys_loglevel_option_handler (graph, vme, "brick");
+ if (!ret)
+ ret = logger_option_handler (graph, vme, "brick");
+
+ if (!ret)
+ ret = log_format_option_handler (graph, vme, "brick");
+
return ret;
}
@@ -2536,7 +2580,9 @@ client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
char *tmp = NULL;
gf_boolean_t var = _gf_false;
gf_boolean_t ob = _gf_false;
+ xlator_t *this = THIS;
+ GF_ASSERT (this);
GF_ASSERT (conf);
volname = volinfo->volname;
@@ -2613,7 +2659,7 @@ client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
ob = _gf_false;
ret = gf_string2boolean (tmp, &ob);
if (!ret && ob) {
- gf_log (THIS->name, GF_LOG_WARNING,
+ gf_log (this->name, GF_LOG_WARNING,
"root-squash is enabled. Please turn it"
" off to change read-after-open "
"option");
@@ -2682,7 +2728,7 @@ client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
ret = 0;
}
if (ret) {
- gf_log (THIS->name, GF_LOG_WARNING, "setting "
+ gf_log (this->name, GF_LOG_WARNING, "setting "
"open behind option as part of root "
"squash failed");
goto out;
@@ -2708,14 +2754,28 @@ client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
&loglevel_option_handler);
if (ret)
- gf_log (THIS->name, GF_LOG_WARNING, "changing client log level"
+ gf_log (this->name, GF_LOG_WARNING, "changing client log level"
" failed");
ret = volgen_graph_set_options_generic (graph, set_dict, "client",
&sys_loglevel_option_handler);
if (ret)
- gf_log (THIS->name, GF_LOG_WARNING, "changing client syslog "
+ gf_log (this->name, GF_LOG_WARNING, "changing client syslog "
"level failed");
+
+ ret = volgen_graph_set_options_generic (graph, set_dict, "client",
+ &logger_option_handler);
+
+ if (ret)
+ gf_log (this->name, GF_LOG_WARNING, "changing client logger"
+ " failed");
+
+ ret = volgen_graph_set_options_generic (graph, set_dict, "client",
+ &log_format_option_handler);
+ if (ret)
+ gf_log (this->name, GF_LOG_WARNING, "changing client log format"
+ " failed");
+
out:
return ret;
}
@@ -3052,16 +3112,31 @@ build_shd_graph (volgen_graph_t *graph, dict_t *mod_dict)
&loglevel_option_handler);
if (ret)
- gf_log (THIS->name, GF_LOG_WARNING, "changing loglevel "
+ gf_log (this->name, GF_LOG_WARNING, "changing loglevel "
"of self-heal daemon failed");
ret = volgen_graph_set_options_generic (graph, set_dict,
"client",
&sys_loglevel_option_handler);
if (ret)
- gf_log (THIS->name, GF_LOG_WARNING, "changing syslog "
+ gf_log (this->name, GF_LOG_WARNING, "changing syslog "
"level of self-heal daemon failed");
+ ret = volgen_graph_set_options_generic (graph, set_dict,
+ "client",
+ &logger_option_handler);
+
+ if (ret)
+ gf_log (this->name, GF_LOG_WARNING, "changing logger "
+ "of self-heal daemon failed");
+
+ ret = volgen_graph_set_options_generic (graph, set_dict,
+ "client",
+ &log_format_option_handler);
+ if (ret)
+ gf_log (this->name, GF_LOG_WARNING, "changing log "
+ "format level of self-heal daemon failed");
+
ret = dict_reset (set_dict);
if (ret)
goto out;
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index 7f094c4..29e9f2b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -610,6 +610,28 @@ struct volopt_map_entry glusterd_volopt_map[] = {
.op_version = 1,
.flags = OPT_FLAG_CLIENT_OPT
},
+ { .key = "diagnostics.brick-logger",
+ .voltype = "debug/io-stats",
+ .option = "!logger",
+ .op_version = 4
+ },
+ { .key = "diagnostics.client-logger",
+ .voltype = "debug/io-stats",
+ .option = "!logger",
+ .op_version = 4,
+ .flags = OPT_FLAG_CLIENT_OPT
+ },
+ { .key = "diagnostics.brick-log-format",
+ .voltype = "debug/io-stats",
+ .option = "!log-format",
+ .op_version = 4
+ },
+ { .key = "diagnostics.client-log-format",
+ .voltype = "debug/io-stats",
+ .option = "!log-format",
+ .op_version = 4,
+ .flags = OPT_FLAG_CLIENT_OPT
+ },
/* IO-cache xlator options */
{ .key = "performance.cache-max-file-size",