summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChuck Thier <cthier@gmail.com>2010-08-24 13:41:58 +0000
committerChuck Thier <cthier@gmail.com>2010-08-24 13:41:58 +0000
commitc62707ae72ebeb7da99e7622f889a66ae5d7fc79 (patch)
tree342cdae753ff614471784f4273ca6fb4c3ad7e7d
parent85e043e9a2823eea48b95c0bbe5cc811af9fb79e (diff)
downloadswift-c62707ae72ebeb7da99e7622f889a66ae5d7fc79.tar.gz
Refactored logging configuration so that it has sane defaults
-rwxr-xr-xbin/swift-account-auditor15
-rwxr-xr-xbin/swift-account-reaper13
-rwxr-xr-xbin/swift-account-replicator15
-rwxr-xr-xbin/swift-account-server4
-rwxr-xr-xbin/swift-auth-server4
-rwxr-xr-xbin/swift-container-auditor15
-rwxr-xr-xbin/swift-container-replicator17
-rwxr-xr-xbin/swift-container-server5
-rwxr-xr-xbin/swift-container-updater16
-rwxr-xr-xbin/swift-object-auditor17
-rwxr-xr-xbin/swift-object-replicator18
-rwxr-xr-xbin/swift-object-server4
-rwxr-xr-xbin/swift-object-updater18
-rwxr-xr-xbin/swift-proxy-server4
-rw-r--r--doc/source/deployment_guide.rst297
-rw-r--r--etc/account-server.conf-sample14
-rw-r--r--etc/auth-server.conf-sample6
-rw-r--r--etc/container-server.conf-sample12
-rw-r--r--etc/object-server.conf-sample12
-rw-r--r--etc/proxy-server.conf-sample6
-rw-r--r--swift/common/middleware/auth.py4
-rw-r--r--swift/common/middleware/cache.py4
-rw-r--r--swift/common/utils.py22
-rw-r--r--swift/common/wsgi.py12
-rw-r--r--swift/proxy/server.py4
25 files changed, 254 insertions, 304 deletions
diff --git a/bin/swift-account-auditor b/bin/swift-account-auditor
index cba89e9e6..681adc6a2 100755
--- a/bin/swift-account-auditor
+++ b/bin/swift-account-auditor
@@ -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: \
diff --git a/bin/swift-account-reaper b/bin/swift-account-reaper
index c5619d078..444d19a09 100755
--- a/bin/swift-account-reaper
+++ b/bin/swift-account-reaper
@@ -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: \
diff --git a/bin/swift-account-replicator b/bin/swift-account-replicator
index 284c75159..18bea931a 100755
--- a/bin/swift-account-replicator
+++ b/bin/swift-account-replicator
@@ -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()
diff --git a/bin/swift-account-server b/bin/swift-account-server
index 6be5706ea..8b9a1ec68 100755
--- a/bin/swift-account-server
+++ b/bin/swift-account-server
@@ -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)
diff --git a/bin/swift-auth-server b/bin/swift-auth-server
index 5f32912a9..62e1d8b59 100755
--- a/bin/swift-auth-server
+++ b/bin/swift-auth-server
@@ -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)
diff --git a/bin/swift-container-auditor b/bin/swift-container-auditor
index b00135003..3f22fbf69 100755
--- a/bin/swift-container-auditor
+++ b/bin/swift-container-auditor
@@ -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: \
diff --git a/bin/swift-container-replicator b/bin/swift-container-replicator
index 663cb51db..6e8ae0f41 100755
--- a/bin/swift-container-replicator
+++ b/bin/swift-container-replicator
@@ -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."
- 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]
+ print "Usage: swift-container-replicator <--once> CONFIG_FILE [once]"
sys.exit(1)
+ once = len(args) > 1 and args[1] == 'once'
+ 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()
diff --git a/bin/swift-container-server b/bin/swift-container-server
index f707eb091..02201041b 100755
--- a/bin/swift-container-server
+++ b/bin/swift-container-server
@@ -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)
diff --git a/bin/swift-container-updater b/bin/swift-container-updater
index 7c2311512..c582d1557 100755
--- a/bin/swift-container-updater
+++ b/bin/swift-container-updater
@@ -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:
diff --git a/bin/swift-object-auditor b/bin/swift-object-auditor
index e995ad872..a80065414 100755
--- a/bin/swift-object-auditor
+++ b/bin/swift-object-auditor
@@ -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: \
diff --git a/bin/swift-object-replicator b/bin/swift-object-replicator
index 2f9c4a63e..c01c96aff 100755
--- a/bin/swift-object-replicator
+++ b/bin/swift-object-replicator
@@ -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
diff --git a/bin/swift-object-server b/bin/swift-object-server
index ce74b1719..58b5120bd 100755
--- a/bin/swift-object-server
+++ b/bin/swift-object-server
@@ -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)
diff --git a/bin/swift-object-updater b/bin/swift-object-updater
index a9512a4e7..375e63ec8 100755
--- a/bin/swift-object-updater
+++ b/bin/swift-object-updater
@@ -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()
-
- 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."
+ print "Usage: swift-object-updater CONFIG_FILE [once]"
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)
+ once = len(sys.argv) > 2 and sys.argv[2] == 'once'
+ conf = utils.readconf(sys.argv[1], 'object-updater')
utils.drop_privileges(conf.get('user', 'swift'))
try:
diff --git a/bin/swift-proxy-server b/bin/swift-proxy-server
index c56df2e07..2ed1b5adf 100755
--- a/bin/swift-proxy-server
+++ b/bin/swift-proxy-server
@@ -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)
diff --git a/doc/source/deployment_guide.rst b/doc/source/deployment_guide.rst
index c8b1b810b..e723ddf3e 100644
--- a/doc/source/deployment_guide.rst
+++ b/doc/source/deployment_guide.rst
@@ -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
diff --git a/etc/account-server.conf-sample b/etc/account-server.conf-sample
index 303ab0e00..2c072285f 100644
--- a/etc/account-server.conf-sample
+++ b/etc/account-server.conf-sample
@@ -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
diff --git a/etc/auth-server.conf-sample b/etc/auth-server.conf-sample
index 61c1ffafd..ae02fb07d 100644
--- a/etc/auth-server.conf-sample
+++ b/etc/auth-server.conf-sample
@@ -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
diff --git a/etc/container-server.conf-sample b/etc/container-server.conf-sample
index ccad08c71..f069543f9 100644
--- a/etc/container-server.conf-sample
+++ b/etc/container-server.conf-sample
@@ -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
diff --git a/etc/object-server.conf-sample b/etc/object-server.conf-sample
index 81a35c5cb..61756a619 100644
--- a/etc/object-server.conf-sample
+++ b/etc/object-server.conf-sample
@@ -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
diff --git a/etc/proxy-server.conf-sample b/etc/proxy-server.conf-sample
index 6ebc2ed45..e81cea65a 100644
--- a/etc/proxy-server.conf-sample
+++ b/etc/proxy-server.conf-sample
@@ -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
diff --git a/swift/common/middleware/auth.py b/swift/common/middleware/auth.py
index d35b99241..eb920fad4 100644
--- a/swift/common/middleware/auth.py
+++ b/swift/common/middleware/auth.py
@@ -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
diff --git a/swift/common/middleware/cache.py b/swift/common/middleware/cache.py
index a0dfc81b8..019926175 100644
--- a/swift/common/middleware/cache.py
+++ b/swift/common/middleware/cache.py
@@ -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
diff --git a/swift/common/utils.py b/swift/common/utils.py
index e4962f236..920d54d64 100644
--- a/swift/common/utils.py
+++ b/swift/common/utils.py
@@ -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
diff --git a/swift/common/wsgi.py b/swift/common/wsgi.py
index 2944bd3bd..13c16aad7 100644
--- a/swift/common/wsgi.py
+++ b/swift/common/wsgi.py
@@ -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)
diff --git a/swift/proxy/server.py b/swift/proxy/server.py
index 82b642ab2..5cfb23fbd 100644
--- a/swift/proxy/server.py
+++ b/swift/proxy/server.py
@@ -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)