diff options
author | Samuel Just <sam.just@inktank.com> | 2015-03-31 09:26:56 -0700 |
---|---|---|
committer | Samuel Just <sam.just@inktank.com> | 2015-03-31 09:26:56 -0700 |
commit | e5ff97201f422f26ae63144118df6ed69d54f055 (patch) | |
tree | 6bfcf742de08c3e0f4b930480dbc587cc5abd79c | |
parent | 6f4936ee96e595cb05a18444e6572e334e98de44 (diff) | |
parent | ccc08397e62477b7fb54f21f08c21ec38041eb2e (diff) | |
download | ceph-e5ff97201f422f26ae63144118df6ed69d54f055.tar.gz |
Merge pull request #4207 from ceph/wip-11177
common: fix logging default channel to be 'cluster' not 'default' (11177)
Reviewed-by: Samuel Just <sjust@redhat.com>
-rw-r--r-- | src/common/LogClient.cc | 22 | ||||
-rw-r--r-- | src/common/LogEntry.h | 6 | ||||
-rw-r--r-- | src/mon/LogMonitor.cc | 10 | ||||
-rw-r--r-- | src/mon/LogMonitor.h | 11 |
4 files changed, 29 insertions, 20 deletions
diff --git a/src/common/LogClient.cc b/src/common/LogClient.cc index 85350e24ac5..756297b7bbf 100644 --- a/src/common/LogClient.cc +++ b/src/common/LogClient.cc @@ -49,28 +49,28 @@ int parse_log_client_options(CephContext *cct, ostringstream oss; int r = get_conf_str_map_helper(cct->_conf->clog_to_monitors, oss, - &log_to_monitors, CLOG_CHANNEL_DEFAULT); + &log_to_monitors, CLOG_CONFIG_DEFAULT_KEY); if (r < 0) { lderr(cct) << __func__ << " error parsing 'clog_to_monitors'" << dendl; return r; } r = get_conf_str_map_helper(cct->_conf->clog_to_syslog, oss, - &log_to_syslog, CLOG_CHANNEL_DEFAULT); + &log_to_syslog, CLOG_CONFIG_DEFAULT_KEY); if (r < 0) { lderr(cct) << __func__ << " error parsing 'clog_to_syslog'" << dendl; return r; } r = get_conf_str_map_helper(cct->_conf->clog_to_syslog_facility, oss, - &log_channels, CLOG_CHANNEL_DEFAULT); + &log_channels, CLOG_CONFIG_DEFAULT_KEY); if (r < 0) { lderr(cct) << __func__ << " error parsing 'clog_to_syslog_facility'" << dendl; return r; } r = get_conf_str_map_helper(cct->_conf->clog_to_syslog_level, oss, - &log_prios, CLOG_CHANNEL_DEFAULT); + &log_prios, CLOG_CONFIG_DEFAULT_KEY); if (r < 0) { lderr(cct) << __func__ << " error parsing 'clog_to_syslog_level'" << dendl; return r; @@ -132,13 +132,19 @@ void LogChannel::update_config(map<string,string> &log_to_monitors, map<string,string> &log_channels, map<string,string> &log_prios) { + ldout(cct, 20) << __func__ << " log_to_monitors " << log_to_monitors + << " log_to_syslog " << log_to_syslog + << " log_channels " << log_channels + << " log_prios " << log_prios + << dendl; bool to_monitors = (get_str_map_key(log_to_monitors, log_channel, - &CLOG_CHANNEL_DEFAULT) == "true"); + &CLOG_CONFIG_DEFAULT_KEY) == "true"); bool to_syslog = (get_str_map_key(log_to_syslog, log_channel, - &CLOG_CHANNEL_DEFAULT) == "true"); + &CLOG_CONFIG_DEFAULT_KEY) == "true"); string syslog_facility = get_str_map_key(log_channels, log_channel, - &CLOG_CHANNEL_DEFAULT); - string prio = get_str_map_key(log_prios, log_channel, &CLOG_CHANNEL_DEFAULT); + &CLOG_CONFIG_DEFAULT_KEY); + string prio = get_str_map_key(log_prios, log_channel, + &CLOG_CONFIG_DEFAULT_KEY); set_log_to_monitors(to_monitors); set_log_to_syslog(to_syslog); diff --git a/src/common/LogEntry.h b/src/common/LogEntry.h index 63badffbfb7..71d3acd5fef 100644 --- a/src/common/LogEntry.h +++ b/src/common/LogEntry.h @@ -34,10 +34,14 @@ typedef enum { } clog_type; static const std::string CLOG_CHANNEL_NONE = "none"; -static const std::string CLOG_CHANNEL_DEFAULT = "default"; +static const std::string CLOG_CHANNEL_DEFAULT = "cluster"; static const std::string CLOG_CHANNEL_CLUSTER = "cluster"; static const std::string CLOG_CHANNEL_AUDIT = "audit"; +// this is the key name used in the config options for the default, e.g. +// default=true foo=false bar=false +static const std::string CLOG_CONFIG_DEFAULT_KEY = "default"; + /* * Given a clog log_type, return the equivalent syslog priority */ diff --git a/src/mon/LogMonitor.cc b/src/mon/LogMonitor.cc index 05bb73fd9b5..aa1f674e83a 100644 --- a/src/mon/LogMonitor.cc +++ b/src/mon/LogMonitor.cc @@ -596,7 +596,7 @@ void LogMonitor::update_log_channels() int r = get_conf_str_map_helper(g_conf->mon_cluster_log_to_syslog, oss, &channels.log_to_syslog, - CLOG_CHANNEL_DEFAULT); + CLOG_CONFIG_DEFAULT_KEY); if (r < 0) { derr << __func__ << " error parsing 'mon_cluster_log_to_syslog'" << dendl; return; @@ -604,7 +604,7 @@ void LogMonitor::update_log_channels() r = get_conf_str_map_helper(g_conf->mon_cluster_log_to_syslog_level, oss, &channels.syslog_level, - CLOG_CHANNEL_DEFAULT); + CLOG_CONFIG_DEFAULT_KEY); if (r < 0) { derr << __func__ << " error parsing 'mon_cluster_log_to_syslog_level'" << dendl; @@ -613,7 +613,7 @@ void LogMonitor::update_log_channels() r = get_conf_str_map_helper(g_conf->mon_cluster_log_to_syslog_facility, oss, &channels.syslog_facility, - CLOG_CHANNEL_DEFAULT); + CLOG_CONFIG_DEFAULT_KEY); if (r < 0) { derr << __func__ << " error parsing 'mon_cluster_log_to_syslog_facility'" << dendl; @@ -622,7 +622,7 @@ void LogMonitor::update_log_channels() r = get_conf_str_map_helper(g_conf->mon_cluster_log_file, oss, &channels.log_file, - CLOG_CHANNEL_DEFAULT); + CLOG_CONFIG_DEFAULT_KEY); if (r < 0) { derr << __func__ << " error parsing 'mon_cluster_log_file'" << dendl; return; @@ -630,7 +630,7 @@ void LogMonitor::update_log_channels() r = get_conf_str_map_helper(g_conf->mon_cluster_log_file_level, oss, &channels.log_file_level, - CLOG_CHANNEL_DEFAULT); + CLOG_CONFIG_DEFAULT_KEY); if (r < 0) { derr << __func__ << " error parsing 'mon_cluster_log_file_level'" << dendl; diff --git a/src/mon/LogMonitor.h b/src/mon/LogMonitor.h index cf870130e43..4cbeb6ec41f 100644 --- a/src/mon/LogMonitor.h +++ b/src/mon/LogMonitor.h @@ -71,17 +71,17 @@ private: bool do_log_to_syslog(const string &channel) { return (get_str_map_key(log_to_syslog, channel, - &CLOG_CHANNEL_DEFAULT) == "true"); + &CLOG_CONFIG_DEFAULT_KEY) == "true"); } string get_facility(const string &channel) { return get_str_map_key(syslog_facility, channel, - &CLOG_CHANNEL_DEFAULT); + &CLOG_CONFIG_DEFAULT_KEY); } string get_level(const string &channel) { return get_str_map_key(syslog_level, channel, - &CLOG_CHANNEL_DEFAULT); + &CLOG_CONFIG_DEFAULT_KEY); } string get_log_file(const string &channel) { @@ -90,8 +90,7 @@ private: if (expanded_log_file.count(channel) == 0) { string fname = expand_channel_meta( - get_str_map_key(log_file, channel, - &CLOG_CHANNEL_DEFAULT), + get_str_map_key(log_file, channel, &CLOG_CONFIG_DEFAULT_KEY), channel); expanded_log_file[channel] = fname; @@ -104,7 +103,7 @@ private: string get_log_file_level(const string &channel) { return get_str_map_key(log_file_level, channel, - &CLOG_CHANNEL_DEFAULT); + &CLOG_CONFIG_DEFAULT_KEY); } } channels; |