added content_type config for uploaded logs

This commit is contained in:
John Dickinson 2012-05-15 10:17:54 -05:00
parent 9dac908f55
commit 2b74f59798
2 changed files with 6 additions and 0 deletions

View File

@ -34,6 +34,7 @@ class_path = slogging.access_processor.AccessLogProcessor
# list of swift.sources (see swift/proxy/server.py posthooklogger)
# that count as service traffic
# service_log_sources =
# content_type =
[log-processor-stats]
# log_dir = /var/log/swift/
@ -45,6 +46,7 @@ class_path = slogging.stats_processor.StatsLogProcessor
# devices = /srv/node
# mount_check = true
# user = swift
# content_type =
[log-processor-container-stats]
# log_dir = /var/log/swift/
@ -58,3 +60,4 @@ processable = false
# mount_check = true
# user = swift
# metadata_keys = comma separated list of user metadata keys to be collected
# content_type =

View File

@ -81,6 +81,7 @@ class LogUploader(Daemon):
(?P<day>[0-3][0-9])
(?P<hour>[0-2][0-9])
.*$''' % plugin_name)
self.content_type = uploader_conf.get('content_type')
def run_once(self, *args, **kwargs):
self.logger.info(_("Uploading logs"))
@ -185,6 +186,8 @@ class LogUploader(Daemon):
# more than one time. By using md5, we get an etag for free.
target_filename = '/'.join([year, month, day, hour, filehash + '.gz'])
metadata = {'x-object-meta-original-name': filename}
if self.content_type:
metadata['Content-Type'] = self.content_type
if self.internal_proxy.upload_file(filename,
self.swift_account,
self.container_name,