OPTION(mon_cluster_log_to_syslog, OPT_STR)
OPTION(mon_cluster_log_to_syslog_level, OPT_STR) // this level and above
OPTION(mon_cluster_log_to_syslog_facility, OPT_STR)
+OPTION(mon_cluster_log_to_file, OPT_BOOL)
OPTION(mon_cluster_log_file, OPT_STR)
OPTION(mon_cluster_log_file_level, OPT_STR)
OPTION(mon_cluster_log_to_graylog, OPT_STR)
.set_description("Syslog facility for cluster log messages")
.add_see_also("mon_cluster_log_to_syslog"),
+ Option("mon_cluster_log_to_file", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
+ .set_default(true)
+ .add_service("mon")
+ .set_description("Make monitor send cluster log messages to file")
+ .add_see_also("mon_cluster_log_file"),
+
Option("mon_cluster_log_file", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("default=/var/log/ceph/$cluster.$channel.log cluster=/var/log/ceph/$cluster.log")
.add_service("mon")
.set_description("File(s) to write cluster log to")
- .set_long_description("This can either be a simple file name to receive all messages, or a list of key/value pairs where the key is the log channel and the value is the filename, which may include $cluster and $channel metavariables"),
+ .set_long_description("This can either be a simple file name to receive all messages, or a list of key/value pairs where the key is the log channel and the value is the filename, which may include $cluster and $channel metavariables")
+ .add_see_also("mon_cluster_log_to_file"),
Option("mon_cluster_log_file_level", Option::TYPE_STR, Option::LEVEL_ADVANCED)
.set_default("debug")
<< " host:" << channels.log_to_graylog_host << dendl;
}
- string log_file = channels.get_log_file(channel);
- dout(20) << __func__ << " logging for channel '" << channel
- << "' to file '" << log_file << "'" << dendl;
-
- if (!log_file.empty()) {
- string log_file_level = channels.get_log_file_level(channel);
- if (log_file_level.empty()) {
- dout(1) << __func__ << " warning: log file level not defined for"
- << " channel '" << channel << "' yet a log file is --"
- << " will assume lowest level possible" << dendl;
- }
+ if (g_conf()->mon_cluster_log_to_file) {
+ string log_file = channels.get_log_file(channel);
+ dout(20) << __func__ << " logging for channel '" << channel
+ << "' to file '" << log_file << "'" << dendl;
+
+ if (!log_file.empty()) {
+ string log_file_level = channels.get_log_file_level(channel);
+ if (log_file_level.empty()) {
+ dout(1) << __func__ << " warning: log file level not defined for"
+ << " channel '" << channel << "' yet a log file is --"
+ << " will assume lowest level possible" << dendl;
+ }
- int min = string_to_syslog_level(log_file_level);
- int l = clog_type_to_syslog_level(le.prio);
- if (l <= min) {
- stringstream ss;
- ss << le << "\n";
- // init entry if DNE
- bufferlist &blog = channel_blog[channel];
- blog.append(ss.str());
+ int min = string_to_syslog_level(log_file_level);
+ int l = clog_type_to_syslog_level(le.prio);
+ if (l <= min) {
+ stringstream ss;
+ ss << le << "\n";
+ // init entry if DNE
+ bufferlist &blog = channel_blog[channel];
+ blog.append(ss.str());
+ }
}
}