diff --git a/doc/source/overview_stats.rst b/doc/source/overview_stats.rst index 0639a8e044..9aa53b737f 100644 --- a/doc/source/overview_stats.rst +++ b/doc/source/overview_stats.rst @@ -143,6 +143,7 @@ Running the stats system on SAIO container_name = container_stats log_dir = /var/log/swift/stats/ class_path = swift.stats.stats_processor.StatsLogProcessor + processable = false devices = /srv/1/node mount_check = false user = diff --git a/etc/log-processor.conf-sample b/etc/log-processor.conf-sample index 376f60c29f..f014168a90 100644 --- a/etc/log-processor.conf-sample +++ b/etc/log-processor.conf-sample @@ -50,6 +50,7 @@ container_name = container_stats # new_log_cutoff = 7200 # unlink_log = True class_path = swift.stats.stats_processor.StatsLogProcessor +processable = false # devices = /srv/node # mount_check = true # user = swift diff --git a/swift/stats/db_stats_collector.py b/swift/stats/db_stats_collector.py index 1e9e4e2702..04968f181f 100644 --- a/swift/stats/db_stats_collector.py +++ b/swift/stats/db_stats_collector.py @@ -143,8 +143,7 @@ class ContainerStatsCollector(DatabaseStatsCollector): broker = ContainerBroker(db_path) if not broker.is_deleted(): info = broker.get_info() - encoded_container_name = urllib.quote( - unicode(info['container'], 'utf-8').encode('utf-8')) + encoded_container_name = urllib.quote(info['container']) line_data = '"%s","%s",%d,%d\n' % ( info['account'], encoded_container_name, diff --git a/swift/stats/log_processor.py b/swift/stats/log_processor.py index 22a9679ca7..9def2c0671 100644 --- a/swift/stats/log_processor.py +++ b/swift/stats/log_processor.py @@ -27,7 +27,7 @@ import hashlib from swift.common.internal_proxy import InternalProxy from swift.common.exceptions import ChunkReadTimeout -from swift.common.utils import get_logger, readconf +from swift.common.utils import get_logger, readconf, TRUE_VALUES from swift.common.daemon import Daemon now = datetime.datetime.now @@ -56,6 +56,8 @@ class LogProcessor(object): for section in (x for x in conf if x.startswith(plugin_prefix)): plugin_name = section[len(plugin_prefix):] plugin_conf = conf.get(section, {}) + if plugin_conf.get('processable', 'true').lower() not in TRUE_VALUES: + continue self.plugins[plugin_name] = plugin_conf class_path = self.plugins[plugin_name]['class_path'] import_target, class_name = class_path.rsplit('.', 1) diff --git a/swift/stats/log_uploader.py b/swift/stats/log_uploader.py index bb1920b055..857327fdad 100644 --- a/swift/stats/log_uploader.py +++ b/swift/stats/log_uploader.py @@ -128,9 +128,10 @@ class LogUploader(Daemon): all_files = self.get_relpath_to_files_under_log_dir() filename2match = self.filter_files(all_files) if not filename2match: - sys.exit(_('No files in %(log_dir)s match %(pattern)s') % + self.logger.error(_('No files in %(log_dir)s match %(pattern)s') % {'log_dir': self.log_dir, 'pattern': self.filename_pattern}) + sys.exit(1) if not self.internal_proxy.create_container(self.swift_account, self.container_name): self.logger.error(_('Unable to create container for '