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;
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);
} 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
*/
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;
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;
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;
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;
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;
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) {
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;
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;