Refactored logging configuration so that it has sane defaults

This commit is contained in:
Chuck Thier 2010-08-24 13:41:58 +00:00
parent 85e043e9a2
commit c62707ae72
25 changed files with 254 additions and 304 deletions

View File

@ -24,23 +24,12 @@ from swift.common import utils
if __name__ == '__main__':
if len(sys.argv) < 2:
print "Usage: account-auditor CONFIG_FILE [once]"
print "Usage: swift-account-auditor CONFIG_FILE [once]"
sys.exit()
once = len(sys.argv) > 2 and sys.argv[2] == 'once'
c = ConfigParser()
if not c.read(sys.argv[1]):
print "Unable to read config file."
sys.exit(1)
if c.has_section('account-auditor'):
conf = dict(c.items('account-auditor'))
else:
print "Unable to find account-auditor config section in %s." % \
sys.argv[1]
sys.exit(1)
conf = utils.readconf(sys.argv[1], 'account-auditor')
logger = utils.get_logger(conf)
# log uncaught exceptions
sys.excepthook = lambda *exc_info: \

View File

@ -29,18 +29,7 @@ if __name__ == '__main__':
once = len(sys.argv) > 2 and sys.argv[2] == 'once'
c = ConfigParser()
if not c.read(sys.argv[1]):
print "Unable to read config file."
sys.exit(1)
if c.has_section('account-reaper'):
conf = dict(c.items('account-reaper'))
else:
print "Unable to find account-reaper config section in %s." % \
sys.argv[1]
sys.exit(1)
conf = utils.readconf(sys.argv[1], 'account-reaper')
logger = utils.get_logger(conf)
# log uncaught exceptions
sys.excepthook = lambda *exc_info: \

View File

@ -32,22 +32,11 @@ if __name__ == '__main__':
optlist, args = getopt.getopt(sys.argv[1:], '', ['once'])
if not args:
print "Usage: account-replicator <--once> CONFIG_FILE [once]"
print "Usage: swift-account-replicator <--once> CONFIG_FILE [once]"
sys.exit()
c = ConfigParser()
if not c.read(args[0]):
print "Unable to read config file."
sys.exit(1)
once = len(args) > 1 and args[1] == 'once'
if c.has_section('account-replicator'):
conf = dict(c.items('account-replicator'))
else:
print "Unable to find account-replicator config section in %s." % \
args[0]
sys.exit(1)
conf = utils.readconf(sys.argv[1], 'account-replicator')
utils.drop_privileges(conf.get('user', 'swift'))
if once or '--once' in [opt[0] for opt in optlist]:
AccountReplicator(conf).replicate_once()

View File

@ -20,6 +20,6 @@ from swift.common.wsgi import run_wsgi
if __name__ == '__main__':
if len(sys.argv) != 2:
print "Usage: %s CONFIG_FILE"
run_wsgi(sys.argv[1], default_port=6002)
print "Usage: %s CONFIG_FILE" % sys.argv[0]
run_wsgi(sys.argv[1], 'account-server', default_port=6002)

View File

@ -20,6 +20,6 @@ from swift.common.wsgi import run_wsgi
if __name__ == '__main__':
if len(sys.argv) != 2:
print "Usage: %s CONFIG_FILE"
run_wsgi(sys.argv[1], default_port=11000)
print "Usage: %s CONFIG_FILE" % sys.argv[0]
run_wsgi(sys.argv[1], 'auth-server', default_port=11000)

View File

@ -24,23 +24,12 @@ from swift.common import utils
if __name__ == '__main__':
if len(sys.argv) < 2:
print "Usage: container-auditor CONFIG_FILE [once]"
print "Usage: swift-container-auditor CONFIG_FILE [once]"
sys.exit()
once = len(sys.argv) > 2 and sys.argv[2] == 'once'
c = ConfigParser()
if not c.read(sys.argv[1]):
print "Unable to read config file."
sys.exit(1)
if c.has_section('container-auditor'):
conf = dict(c.items('container-auditor'))
else:
print "Unable to find container-auditor config section in %s." % \
sys.argv[1]
sys.exit(1)
conf = utils.readconf(sys.argv[1], 'container-auditor')
logger = utils.get_logger(conf)
# log uncaught exceptions
sys.excepthook = lambda *exc_info: \

View File

@ -32,22 +32,11 @@ if __name__ == '__main__':
optlist, args = getopt.getopt(sys.argv[1:], '', ['once'])
if not args:
print "Usage: container-replicator <--once> CONFIG_FILE [once]"
sys.exit()
c = ConfigParser()
if not c.read(args[0]):
print "Unable to read config file."
print "Usage: swift-container-replicator <--once> CONFIG_FILE [once]"
sys.exit(1)
once = len(args) > 1 and args[1] == 'once'
if c.has_section('container-replicator'):
conf = dict(c.items('container-replicator'))
else:
print "Unable to find container-replicator config section in %s." % \
args[0]
sys.exit(1)
conf = utils.readconf(args[0], 'container-replicator')
utils.drop_privileges(conf.get('user', 'swift'))
if once or '--once' in [opt[0] for opt in optlist]:
ContainerReplicator(conf).replicate_once()

View File

@ -20,6 +20,5 @@ from swift.common.wsgi import run_wsgi
if __name__ == '__main__':
if len(sys.argv) != 2:
print "Usage: %s CONFIG_FILE"
run_wsgi(sys.argv[1], default_port=6001)
print "Usage: %s CONFIG_FILE" % sys.argv[0]
run_wsgi(sys.argv[1], 'container-server', default_port=6001)

View File

@ -24,23 +24,11 @@ from swift.common import utils
if __name__ == '__main__':
if len(sys.argv) < 2:
print "Usage: container-updater CONFIG_FILE [once]"
print "Usage: swift-container-updater CONFIG_FILE [once]"
sys.exit()
once = len(sys.argv) > 2 and sys.argv[2] == 'once'
c = ConfigParser()
if not c.read(sys.argv[1]):
print "Unable to read config file."
sys.exit(1)
if c.has_section('container-updater'):
conf = dict(c.items('container-updater'))
else:
print "Unable to find container-updater config section in %s." % \
sys.argv[1]
sys.exit(1)
conf = readconf(sys.argv[1], 'container-updater')
utils.drop_privileges(conf.get('user', 'swift'))
try:

View File

@ -17,30 +17,17 @@
import os
import signal
import sys
from ConfigParser import ConfigParser
from swift.obj.auditor import ObjectAuditor
from swift.common import utils
if __name__ == '__main__':
if len(sys.argv) < 2:
print "Usage: object-auditor CONFIG_FILE [once]"
print "Usage: swift-object-auditor CONFIG_FILE [once]"
sys.exit()
once = len(sys.argv) > 2 and sys.argv[2] == 'once'
c = ConfigParser()
if not c.read(sys.argv[1]):
print "Unable to read config file."
sys.exit(1)
if c.has_section('object-auditor'):
conf = dict(c.items('object-auditor'))
else:
print "Unable to find object-auditor config section in %s." % \
sys.argv[1]
sys.exit(1)
conf = utils.readconf(sys.argv[1], 'object-auditor')
logger = utils.get_logger(conf)
# log uncaught exceptions
sys.excepthook = lambda *exc_info: \

View File

@ -15,7 +15,6 @@
# limitations under the License.
import sys
from ConfigParser import ConfigParser
import logging
import time
@ -23,25 +22,16 @@ from eventlet import sleep, hubs
hubs.use_hub('poll')
from swift.obj.replicator import ObjectReplicator
from swift.common.utils import get_logger, drop_privileges, LoggerFileObject
from swift.common.utils import get_logger, drop_privileges, LoggerFileObject, \
readconf
TRUE_VALUES = set(('true', '1', 'yes', 'True', 'Yes'))
if __name__ == '__main__':
if len(sys.argv) < 2:
print "Usage: object-replicator CONFIG_FILE [once]"
print "Usage: swift-object-replicator CONFIG_FILE [once]"
sys.exit()
c = ConfigParser()
if not c.read(sys.argv[1]):
print "Unable to read config file"
sys.exit(1)
if c.has_section('object-replicator'):
conf = dict(c.items('object-replicator'))
else:
print "Unable to find object-replicator config section in %s" % \
sys.argv[1]
sys.exit(1)
conf = readconf(sys.argv[1], "object-replicator")
once = len(sys.argv) > 2 and sys.argv[2] == 'once'
logger = get_logger(conf)
# log uncaught exceptions

View File

@ -20,5 +20,5 @@ from swift.common.wsgi import run_wsgi
if __name__ == '__main__':
if len(sys.argv) != 2:
print "Usage: %s CONFIG_FILE"
run_wsgi(sys.argv[1], default_port=6000)
print "Usage: %s CONFIG_FILE" % sys.argv[0]
run_wsgi(sys.argv[1], 'object-server', default_port=6000)

View File

@ -17,30 +17,18 @@
import os
import signal
import sys
from ConfigParser import ConfigParser
from swift.obj.updater import ObjectUpdater
from swift.common import utils
if __name__ == '__main__':
if len(sys.argv) < 2:
print "Usage: object-updater CONFIG_FILE [once]"
sys.exit()
print "Usage: swift-object-updater CONFIG_FILE [once]"
sys.exit(1)
once = len(sys.argv) > 2 and sys.argv[2] == 'once'
c = ConfigParser()
if not c.read(sys.argv[1]):
print "Unable to read config file."
sys.exit(1)
if c.has_section('object-updater'):
conf = dict(c.items('object-updater'))
else:
print "Unable to find object-updater config section in %s." % \
sys.argv[1]
sys.exit(1)
conf = utils.readconf(sys.argv[1], 'object-updater')
utils.drop_privileges(conf.get('user', 'swift'))
try:

View File

@ -20,5 +20,5 @@ from swift.common.wsgi import run_wsgi
if __name__ == '__main__':
if len(sys.argv) != 2:
print "Usage: %s CONFIG_FILE"
run_wsgi(sys.argv[1], default_port=80)
print "Usage: %s CONFIG_FILE" % sys.argv[0]
run_wsgi(sys.argv[1], 'proxy-server', default_port=80)

View File

@ -152,9 +152,6 @@ The following configuration options are available:
================== ========== =============================================
Option Default Description
------------------ ---------- ---------------------------------------------
log_name swift Label used when logging
log_facility LOG_LOCAL0 Syslog log facility
log_level INFO Logging level
swift_dir /etc/swift Swift configuration directory
devices /srv/node Parent directory of where devices are mounted
mount_check true Weather or not check if the devices are
@ -167,63 +164,75 @@ workers 1 Number of workers to fork
[object-server]
================== ========== =============================================
Option Default Description
------------------ ---------- ---------------------------------------------
use paste.deploy entrypoint for the object
server. For most cases, this should be
`egg:swift#object`.
log_requests True Weather or not to log each request
user swift User to run as
node_timeout 3 Request timeout to external services
conn_timeout 0.5 Connection timeout to external services
network_chunk_size 65536 Size of chunks to read/write over the
network
disk_chunk_size 65536 Size of chunks to read/write to disk
max_upload_time 86400 Maximum time allowed to upload an object
slow 0 If > 0, Minimum time in seconds for a PUT
or DELETE request to complete
================== ========== =============================================
================== ============= ===========================================
Option Default Description
------------------ ------------- -------------------------------------------
use paste.deploy entrypoint for the object
server. For most cases, this should be
`egg:swift#object`.
log_name object-server Label used when logging
log_facility LOG_LOCAL0 Syslog log facility
log_level INFO Logging level
log_requests True Weather or not to log each request
user swift User to run as
node_timeout 3 Request timeout to external services
conn_timeout 0.5 Connection timeout to external services
network_chunk_size 65536 Size of chunks to read/write over the
network
disk_chunk_size 65536 Size of chunks to read/write to disk
max_upload_time 86400 Maximum time allowed to upload an object
slow 0 If > 0, Minimum time in seconds for a PUT
or DELETE request to complete
================== ============= ===========================================
[object-replicator]
================== ========== ===========================================
Option Default Description
------------------ ---------- -------------------------------------------
daemonize yes Weather or not to run replication as a
daemon
run_pause 30 Time in seconds to wait between replication
passes
concurrency 1 Number of replication workers to spawn
timeout 5 Timeout value sent to rsync --timeout and
--contimeout options
stats_interval 3600 Interval in seconds between logging
replication statistics
reclaim_age 604800 Time elapsed in seconds before an object
can be reclaimed
================== ========== ===========================================
================== ================= =======================================
Option Default Description
------------------ ----------------- ---------------------------------------
log_name object-replicator Label used when logging
log_facility LOG_LOCAL0 Syslog log facility
log_level INFO Logging level
daemonize yes Weather or not to run replication as a
daemon
run_pause 30 Time in seconds to wait between
replication passes
concurrency 1 Number of replication workers to spawn
timeout 5 Timeout value sent to rsync --timeout
and --contimeout options
stats_interval 3600 Interval in seconds between logging
replication statistics
reclaim_age 604800 Time elapsed in seconds before an
object can be reclaimed
================== ================= =======================================
[object-updater]
================== ========== ===========================================
Option Default Description
------------------ ---------- -------------------------------------------
interval 300 Minimum time for a pass to take
concurrency 1 Number of updater workers to spawn
node_timeout 10 Request timeout to external services
conn_timeout 0.5 Connection timeout to external services
slowdown 0.01 Time in seconds to wait between objects
================== ========== ===========================================
================== ============== ==========================================
Option Default Description
------------------ -------------- ------------------------------------------
log_name object-updater Label used when logging
log_facility LOG_LOCAL0 Syslog log facility
log_level INFO Logging level
interval 300 Minimum time for a pass to take
concurrency 1 Number of updater workers to spawn
node_timeout 10 Request timeout to external services
conn_timeout 0.5 Connection timeout to external services
slowdown 0.01 Time in seconds to wait between objects
================== ============== ==========================================
[object-auditor]
================== ========== ===========================================
Option Default Description
------------------ ---------- -------------------------------------------
interval 1800 Minimum time for a pass to take
node_timeout 10 Request timeout to external services
conn_timeout 0.5 Connection timeout to external services
================== ========== ===========================================
================== ============== ==========================================
Option Default Description
------------------ -------------- ------------------------------------------
log_name object-auditor Label used when logging
log_facility LOG_LOCAL0 Syslog log facility
log_level INFO Logging level
interval 1800 Minimum time for a pass to take
node_timeout 10 Request timeout to external services
conn_timeout 0.5 Connection timeout to external services
================== ============== ==========================================
------------------------------
Container Server Configuration
@ -239,9 +248,6 @@ The following configuration options are available:
================== ========== ============================================
Option Default Description
------------------ ---------- --------------------------------------------
log_name swift Label used when logging
log_facility LOG_LOCAL0 Syslog log facility
log_level INFO Logging level
swift_dir /etc/swift Swift configuration directory
devices /srv/node Parent irectory of where devices are mounted
mount_check true Weather or not check if the devices are
@ -255,52 +261,67 @@ user swift User to run as
[container-server]
================== ========== ============================================
Option Default Description
------------------ ---------- --------------------------------------------
use paste.deploy entrypoint for the container
server. For most cases, this should be
`egg:swift#container`.
node_timeout 3 Request timeout to external services
conn_timeout 0.5 Connection timeout to external services
================== ========== ============================================
================== ================ ========================================
Option Default Description
------------------ ---------------- ----------------------------------------
use paste.deploy entrypoint for the container
server. For most cases, this should be
`egg:swift#container`.
log_name container-server Label used when logging
log_facility LOG_LOCAL0 Syslog log facility
log_level INFO Logging level
node_timeout 3 Request timeout to external services
conn_timeout 0.5 Connection timeout to external services
================== ================ ========================================
[container-replicator]
================== ========== ===========================================
Option Default Description
------------------ ---------- -------------------------------------------
================== ==================== ====================================
Option Default Description
------------------ -------------------- ------------------------------------
log_name container-replicator Label used when logging
log_facility LOG_LOCAL0 Syslog log facility
log_level INFO Logging level
per_diff 1000
concurrency 8 Number of replication workers to spawn
run_pause 30 Time in seconds to wait between replication
passes
node_timeout 10 Request timeout to external services
conn_timeout 0.5 Connection timeout to external services
reclaim_age 604800 Time elapsed in seconds before a container
can be reclaimed
================== ========== ===========================================
concurrency 8 Number of replication workers to
spawn
run_pause 30 Time in seconds to wait between
replication passes
node_timeout 10 Request timeout to external services
conn_timeout 0.5 Connection timeout to external
services
reclaim_age 604800 Time elapsed in seconds before a
container can be reclaimed
================== ==================== ====================================
[container-updater]
================== ========== ===========================================
Option Default Description
------------------ ---------- -------------------------------------------
interval 300 Minimum time for a pass to take
concurrency 4 Number of updater workers to spawn
node_timeout 3 Request timeout to external services
conn_timeout 0.5 Connection timeout to external services
slowdown 0.01 Time in seconds to wait between containers
================== ========== ===========================================
================== ================= =======================================
Option Default Description
------------------ ----------------- ---------------------------------------
log_name container-updater Label used when logging
log_facility LOG_LOCAL0 Syslog log facility
log_level INFO Logging level
interval 300 Minimum time for a pass to take
concurrency 4 Number of updater workers to spawn
node_timeout 3 Request timeout to external services
conn_timeout 0.5 Connection timeout to external services
slowdown 0.01 Time in seconds to wait between
containers
================== ================= =======================================
[container-auditor]
================== ========== ===========================================
Option Default Description
------------------ ---------- -------------------------------------------
interval 1800 Minimum time for a pass to take
node_timeout 10 Request timeout to external services
conn_timeout 0.5 Connection timeout to external services
================== ========== ===========================================
================== ================= =======================================
Option Default Description
------------------ ----------------- ---------------------------------------
log_name container-auditor Label used when logging
log_facility LOG_LOCAL0 Syslog log facility
log_level INFO Logging level
interval 1800 Minimum time for a pass to take
node_timeout 10 Request timeout to external services
conn_timeout 0.5 Connection timeout to external services
================== ================= =======================================
----------------------------
Account Server Configuration
@ -316,9 +337,6 @@ The following configuration options are available:
================== ========== =============================================
Option Default Description
------------------ ---------- ---------------------------------------------
log_name swift Label used when logging
log_facility LOG_LOCAL0 Syslog log facility
log_level INFO Logging level
swift_dir /etc/swift Swift configuration directory
devices /srv/node Parent directory or where devices are mounted
mount_check true Weather or not check if the devices are
@ -332,57 +350,63 @@ user swift User to run as
[account-server]
================== ========== =============================================
Option Default Description
------------------ ---------- ---------------------------------------------
use paste.deploy entrypoint for the account
server. For most cases, this should be
`egg:swift#account`.
================== ========== =============================================
================== ============== ==========================================
Option Default Description
------------------ -------------- ------------------------------------------
use paste.deploy entrypoint for the account
server. For most cases, this should be
`egg:swift#account`.
log_name account-server Label used when logging
log_facility LOG_LOCAL0 Syslog log facility
log_level INFO Logging level
================== ============== ==========================================
[account-replicator]
================== ========== ===========================================
Option Default Description
------------------ ---------- -------------------------------------------
log_facility LOG_LOCAL0 Syslog log facility
log_level INFO Logging level
================== ================== ======================================
Option Default Description
------------------ ------------------ --------------------------------------
log_name account-replicator Label used when logging
log_facility LOG_LOCAL0 Syslog log facility
log_level INFO Logging level
per_diff 1000
concurrency 8 Number of replication workers to spawn
run_pause 30 Time in seconds to wait between replication
passes
node_timeout 10 Request timeout to external services
conn_timeout 0.5 Connection timeout to external services
reclaim_age 604800 Time elapsed in seconds before a account
can be reclaimed
================== ========== ===========================================
concurrency 8 Number of replication workers to spawn
run_pause 30 Time in seconds to wait between
replication passes
node_timeout 10 Request timeout to external services
conn_timeout 0.5 Connection timeout to external services
reclaim_age 604800 Time elapsed in seconds before an
account can be reclaimed
================== ================== ======================================
[account-auditor]
==================== ========== ===========================================
Option Default Description
-------------------- ---------- -------------------------------------------
log_facility LOG_LOCAL0 Syslog log facility
log_level INFO Logging level
interval 1800 Minimum time for a pass to take
max_container_count 100 Maximum containers randomly picked for
a given account audit
node_timeout 10 Request timeout to external services
conn_timeout 0.5 Connection timeout to external services
==================== ========== ===========================================
==================== =============== =======================================
Option Default Description
-------------------- --------------- ---------------------------------------
log_name account-auditor Label used when logging
log_facility LOG_LOCAL0 Syslog log facility
log_level INFO Logging level
interval 1800 Minimum time for a pass to take
max_container_count 100 Maximum containers randomly picked for
a given account audit
node_timeout 10 Request timeout to external services
conn_timeout 0.5 Connection timeout to external services
==================== =============== =======================================
[account-reaper]
================== ========== ===========================================
Option Default Description
------------------ ---------- -------------------------------------------
log_facility LOG_LOCAL0 Syslog log facility
log_level INFO Logging level
concurrency 25 Number of replication workers to spawn
interval 3600 Minimum time for a pass to take
node_timeout 10 Request timeout to external services
conn_timeout 0.5 Connection timeout to external services
================== ========== ===========================================
================== =============== =========================================
Option Default Description
------------------ --------------- -----------------------------------------
log_name account-auditor Label used when logging
log_facility LOG_LOCAL0 Syslog log facility
log_level INFO Logging level
concurrency 25 Number of replication workers to spawn
interval 3600 Minimum time for a pass to take
node_timeout 10 Request timeout to external services
conn_timeout 0.5 Connection timeout to external services
================== =============== =========================================
--------------------------
Proxy Server Configuration
@ -393,8 +417,6 @@ Proxy Server Configuration
============================ =============== =============================
Option Default Description
---------------------------- --------------- -----------------------------
log_facility LOG_LOCAL0 Syslog log facility
log_level INFO Log level
bind_ip 0.0.0.0 IP Address for server to
bind to
bind_port 80 Port for server to bind to
@ -414,6 +436,9 @@ use paste.deploy entrypoint for
the proxy server. For most
cases, this should be
`egg:swift#proxy`.
log_name proxy-server Label used when logging
log_facility LOG_LOCAL0 Syslog log facility
log_level INFO Log level
log_headers True If True, log headers in each
request
recheck_account_existence 60 Cache timeout in seconds to

View File

@ -1,7 +1,4 @@
[DEFAULT]
log_name = account
# log_facility = LOG_LOCAL0
# log_level = INFO
# bind_ip = 0.0.0.0
# bind_port = 6002
# workers = 1
@ -15,9 +12,12 @@ pipeline = account-server
[app:account-server]
use = egg:swift#account
# log_name = account-server
# log_facility = LOG_LOCAL0
# log_level = INFO
[account-replicator]
log_name = account-replicator
# log_name = account-replicator
# log_facility = LOG_LOCAL0
# log_level = INFO
# per_diff = 1000
@ -34,7 +34,7 @@ log_name = account-replicator
# reclaim_age = 86400
[account-stats]
log_name = account-stats
# log_name = account-stats
# cf_account = AUTH_7abbc116-8a07-4b63-819d-02715d3e0f31
# container_name = account_stats
# proxy_server_conf = /etc/swift/proxy-server.conf
@ -42,7 +42,7 @@ log_name = account-stats
# log_level = INFO
[account-auditor]
log_name = account-auditor
# log_name = account-auditor
# Will audit, at most, 1 account per device per interval
# interval = 1800
# Maximum containers randomly picked for a given account audit
@ -53,7 +53,7 @@ log_name = account-auditor
# log_level = INFO
[account-reaper]
log_name = account-reaper
# log_name = account-reaper
# concurrency = 25
# interval = 3600
# node_timeout = 10

View File

@ -1,9 +1,6 @@
[DEFAULT]
log_name = auth
# bind_ip = 0.0.0.0
# bind_port = 11000
# log_facility = LOG_LOCAL0
# log_level = INFO
# workers = 1
# user = swift
# swift_dir = /etc/swift
@ -15,6 +12,9 @@ pipeline = auth-server
[app:auth-server]
use = egg:swift#auth
# log_name = auth-server
# log_facility = LOG_LOCAL0
# log_level = INFO
# reseller_prefix = AUTH
# default_cluster_url = http://127.0.0.1:9000/v1
# token_life = 86400

View File

@ -1,7 +1,4 @@
[DEFAULT]
log_name = container
# log_facility = LOG_LOCAL0
# log_level = INFO
# bind_ip = 0.0.0.0
# bind_port = 6001
# workers = 1
@ -15,11 +12,14 @@ pipeline = container-server
[app:container-server]
use = egg:swift#container
# log_name = container-server
# log_facility = LOG_LOCAL0
# log_level = INFO
# node_timeout = 3
# conn_timeout = 0.5
[container-replicator]
log_name = container-replicator
# log_name = container-replicator
# per_diff = 1000
# concurrency = 8
# run_pause = 30
@ -29,7 +29,7 @@ log_name = container-replicator
# reclaim_age = 604800
[container-updater]
log_name = container-updater
# log_name = container-updater
# interval = 300
# concurrency = 4
# node_timeout = 3
@ -38,7 +38,7 @@ log_name = container-updater
# slowdown = 0.01
[container-auditor]
log_name = container-auditor
# log_name = container-auditor
# Will audit, at most, 1 container per device per interval
# interval = 1800
# Maximum objects randomly picked for a given container audit

View File

@ -1,7 +1,4 @@
[DEFAULT]
log_name = object
# log_facility = LOG_LOCAL0
# log_level = INFO
# bind_ip = 0.0.0.0
# bind_port = 6000
# workers = 1
@ -15,6 +12,9 @@ pipeline = object-server
[app:object-server]
use = egg:swift#object
# log_name = object-server
# log_facility = LOG_LOCAL0
# log_level = INFO
# log_requests = True
# node_timeout = 3
# conn_timeout = 0.5
@ -24,7 +24,7 @@ use = egg:swift#object
# slow = 1
[object-replicator]
log_name = object-replicator
# log_name = object-replicator
# daemonize = on
# run_pause = 30
# concurrency = 1
@ -34,7 +34,7 @@ log_name = object-replicator
# reclaim_age = 604800
[object-updater]
log_name = object-updater
# log_name = object-updater
# interval = 300
# concurrency = 1
# node_timeout = 10
@ -43,7 +43,7 @@ log_name = object-updater
# slowdown = 0.01
[object-auditor]
log_name = object-auditor
# log_name = object-auditor
# Will audit, at most, 1 object per device per interval
# interval = 1800
# node_timeout = 10

View File

@ -1,7 +1,4 @@
[DEFAULT]
log_name = proxy
# log_facility = LOG_LOCAL0
# log_level = INFO
# bind_ip = 0.0.0.0
# bind_port = 80
# swift_dir = /etc/swift
@ -15,6 +12,9 @@ pipeline = healthcheck cache auth proxy
[app:proxy]
use = egg:swift#proxy
# log_name = proxy-server
# log_facility = LOG_LOCAL0
# log_level = INFO
# log_headers = False
# recheck_account_existence = 60
# recheck_container_existence = 60

View File

@ -105,6 +105,8 @@ class DevAuthMiddleware(object):
return True
def filter_factory(global_conf, **local_conf):
conf = global_conf.copy()
conf.update(local_conf)
def auth_filter(app):
return DevAuthMiddleware(app, local_conf)
return DevAuthMiddleware(app, conf)
return auth_filter

View File

@ -29,6 +29,8 @@ class CacheMiddleware(object):
return self.app(env, start_response)
def filter_factory(global_conf, **local_conf):
conf = global_conf.copy()
conf.update(local_conf)
def cache_filter(app):
return CacheMiddleware(app, local_conf)
return CacheMiddleware(app, conf)
return cache_filter

View File

@ -31,6 +31,7 @@ import ctypes
import ctypes.util
import fcntl
import struct
from ConfigParser import ConfigParser
import eventlet
from eventlet import greenio, GreenPool, sleep, Timeout, listen
@ -331,6 +332,7 @@ def get_logger(conf, name=None):
log_facility = LOG_LOCAL0
log_level = INFO
log_name = swift
:param conf: Configuration dict to read settings from
:param name: Name of the logger
@ -345,7 +347,8 @@ def get_logger(conf, name=None):
if name is None:
name = conf.get('log_name', 'swift')
get_logger.handler = SysLogHandler(address='/dev/log',
facility=getattr(SysLogHandler, conf.get('log_facility', 'LOG_LOCAL0'),
facility=getattr(SysLogHandler,
conf.get('log_facility', 'LOG_LOCAL0'),
SysLogHandler.LOG_LOCAL0))
root_logger.addHandler(get_logger.handler)
root_logger.setLevel(
@ -524,3 +527,20 @@ def item_from_env(env, item_name):
def cache_from_env(env):
return item_from_env(env, 'swift.cache')
def readconf(conf, section_name, log_name=None):
c = ConfigParser()
if not c.read(conf):
print "Unable to read config file %s" % conf
sys.exit(1)
if c.has_section(section_name):
conf = dict(c.items(section_name))
else:
print "Unable to find %s config section in %s" % (section_name, conf)
sys.exit(1)
if "log_name" not in conf:
if log_name is not None:
conf['log_name'] = log_name
else:
conf['log_name'] = section_name
return conf

View File

@ -59,25 +59,27 @@ def monkey_patch_mimetools():
# We might be able to pull pieces of this out to test, but right now it seems
# like more work than it's worth.
def run_wsgi(conf_file, *args, **kwargs): # pragma: no cover
def run_wsgi(conf_file, app_section, *args, **kwargs): # pragma: no cover
"""
Loads common settings from conf, then instantiates app and runs
the server using the specified number of workers.
:param conf_file: Path to paste.deploy style configuration file
:param app_section: App name from conf file to load config from
"""
try:
app = loadapp('config:%s' % conf_file)
conf = appconfig('config:%s' % conf_file)
conf = appconfig('config:%s' % conf_file, name=app_section)
log_name = conf.get('log_name', app_section)
app = loadapp('config:%s' % conf_file,
global_conf={'log_name':log_name})
except Exception, e:
print "Error trying to load config %s: %s" % (conf_file, e)
return
if 'logger' in kwargs:
logger = kwargs['logger']
else:
logger = get_logger(conf)
logger = get_logger(conf, log_name)
# log uncaught exceptions
sys.excepthook = lambda * exc_info: \
logger.critical('UNCAUGHT EXCEPTION', exc_info=exc_info)

View File

@ -1264,5 +1264,7 @@ class Application(BaseApplication):
return None
def app_factory(global_conf, **local_conf):
conf = global_conf.copy()
conf.update(local_conf)
"""paste.deploy app factory for creating WSGI proxy apps."""
return Application(local_conf)
return Application(conf)