add log configuration

This commit is contained in:
Seyeong Kim 2015-04-09 05:36:21 +00:00
parent 2a732a5451
commit 80bbc65dbe
4 changed files with 40 additions and 3 deletions

View File

@ -122,6 +122,18 @@ options:
Timeouts from these requests can be recovered from so setting this to
something lower than node-timeout would provide quicker error recovery
while allowing for a longer timeout for non-recoverable requests (PUTs).
# Logging configuration
debug:
default: False
type: boolean
description: |
Set log-name, log-facility, log-level, log-address
log-headers:
default: False
type: boolean
description: |
Enables the ability to log request headers.
The default is False.
# Manual Keystone configuration.
keystone-auth-host:
type: string

View File

@ -81,6 +81,10 @@ class SwiftIdentityContext(OSContextGenerator):
def __call__(self):
bind_port = config('bind-port')
workers = config('workers')
log_name = 'swift'
log_facility = 'LOG_LOCAL0'
log_level = 'INFO'
log_address = '/dev/log'
if workers == 0:
import multiprocessing
workers = multiprocessing.cpu_count()
@ -100,8 +104,15 @@ class SwiftIdentityContext(OSContextGenerator):
'delay_auth_decision': config('delay-auth-decision'),
'node_timeout': config('node-timeout'),
'recoverable_node_timeout': config('recoverable-node-timeout'),
'log_headers': config('log-headers')
}
if config('debug'):
ctxt['log_name'] = log_name
ctxt['log_facility'] = log_facility
ctxt['log_level'] = log_level
ctxt['log_address'] = log_address
# Instead of duplicating code lets use charm-helpers to set signing_dir
# TODO(hopem): refactor this context handler to use charm-helpers
# code.

View File

@ -3,6 +3,12 @@ bind_port = {{ bind_port }}
workers = {{ workers }}
user = swift
bind_ip = {{ bind_host }}
log_name = {{ log_name }}
log_facility = {{ log_facility }}
log_level = {{ log_level }}
log_address = {{ log_address }}
log_headers = {{ log_headers }}
{% if ssl %}
cert_file = {{ ssl_cert }}
key_file = {{ ssl_key }}
@ -10,10 +16,10 @@ key_file = {{ ssl_key }}
{% if auth_type == 'keystone' %}
[pipeline:main]
pipeline = gatekeeper healthcheck cache swift3 s3token container_sync bulk tempurl slo dlo formpost authtoken keystoneauth staticweb container-quotas account-quotas proxy-server
pipeline = gatekeeper healthcheck proxy-logging cache swift3 s3token container_sync bulk tempurl slo dlo formpost authtoken keystoneauth staticweb container-quotas account-quotas proxy-logging proxy-server
{% else %}
[pipeline:main]
pipeline = gatekeeper healthcheck cache container_sync bulk tempurl slo dlo formpost tempauth staticweb container-quotas account-quotas proxy-server
pipeline = gatekeeper healthcheck proxy-logging cache container_sync bulk tempurl slo dlo formpost tempauth staticweb container-quotas account-quotas proxy-logging proxy-server
{% endif %}
[app:proxy-server]
@ -40,6 +46,9 @@ use = egg:swift#account_quotas
[filter:container-quotas]
use = egg:swift#container_quotas
[filter:proxy-logging]
use = egg:swift#proxy_logging
[filter:staticweb]
use = egg:swift#staticweb

View File

@ -368,7 +368,12 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment):
expected = {
'DEFAULT': {
'bind_port': '8070',
'user': 'swift'
'user': 'swift',
# 'log_name': 'swift',
# 'log_facility': 'LOG_LOCAL0',
# 'log_level': 'INFO',
# 'log_address': '/dev/log',
# 'log_headers': 'False'
},
'pipeline:main': {
'pipeline': 'gatekeeper healthcheck cache swift3 s3token '