From f68887999e89d894c3125e3b26517221ad1543fc Mon Sep 17 00:00:00 2001 From: "Kaleb S. KEITHLEY" Date: Tue, 1 Aug 2017 08:04:48 -0400 Subject: logging: localtime logging, cmdline, volume set option Despite the fact that appliances generally use UTC, some users really want log entries in localtime. fixes gluster/glusterfs#272 feature page: https://review.gluster.org/17807 Change-Id: I5fbf2c3eedd9eb128fb3f851dd67b2f4081c8bba Signed-off-by: Kaleb S. KEITHLEY Reviewed-on: https://review.gluster.org/16911 CentOS-regression: Gluster Build System Smoke: Gluster Build System Reviewed-by: Samikshan Bairagya Reviewed-by: Shyamsundar Ranganathan --- xlators/mgmt/glusterd/src/glusterd-volgen.c | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'xlators/mgmt/glusterd/src/glusterd-volgen.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 1ada7232f3e..d82e0f1ae86 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -1309,6 +1309,25 @@ log_format_option_handler (volgen_graph_t *graph, struct volopt_map_entry *vme, return basic_option_handler (graph, &vme2, NULL); } +static int +log_localtime_logging_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, "!cluster.localtime-logging") != 0 || + !strstr (vme->key, role)) + return 0; + + memcpy (&vme2, vme, sizeof (vme2)); + vme2.option = GLUSTERD_LOCALTIME_LOGGING_KEY; + + return basic_option_handler (graph, &vme2, NULL); +} + static int log_buf_size_option_handler (volgen_graph_t *graph, struct volopt_map_entry *vme, @@ -1414,6 +1433,9 @@ server_spec_option_handler (volgen_graph_t *graph, if (!ret) ret = log_flush_timeout_option_handler (graph, vme, "brick"); + if (!ret) + ret = log_localtime_logging_option_handler (graph, vme, "brick"); + return ret; } @@ -3974,6 +3996,14 @@ graph_set_generic_options (xlator_t *this, volgen_graph_t *graph, GD_MSG_GRAPH_SET_OPT_FAIL, "Failed to change " "log-flush-timeout option"); + + ret = volgen_graph_set_options_generic (graph, set_dict, "client", + &log_localtime_logging_option_handler); + if (ret) + gf_msg (this->name, GF_LOG_WARNING, 0, + GD_MSG_GRAPH_SET_OPT_FAIL, + "Failed to change " + "log-localtime-logging option"); return 0; } -- cgit