From 769eb1cf4592802409d9487de68ef3cd430f84b2 Mon Sep 17 00:00:00 2001 From: Chmouel Boudjnah Date: Tue, 22 Nov 2011 13:04:40 +0100 Subject: [PATCH] Configure swift logging. Split logs by storage node proxy and don't fill up the /var/log/messages. Set proxy-server in debug. Only one worker by proxy-server since we are usually in debugging mode. Change-Id: If39f35b98ad821e8a62e36e4c22e723f83e01db8 --- files/swift/proxy-server.conf | 5 ++++- files/swift/rsyslog.conf | 26 ++++++++++++++++++++++++++ stack.sh | 14 +++++++++++++- 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 files/swift/rsyslog.conf diff --git a/files/swift/proxy-server.conf b/files/swift/proxy-server.conf index 2db6d322c0..1c567c30c6 100644 --- a/files/swift/proxy-server.conf +++ b/files/swift/proxy-server.conf @@ -1,8 +1,11 @@ [DEFAULT] bind_port = 8080 user = %USER% -log_facility = LOG_LOCAL1 swift_dir = %SWIFT_CONFIG_LOCATION% +workers = 1 +log_name = swift +log_facility = LOG_LOCAL1 +log_level = DEBUG [pipeline:main] pipeline = healthcheck cache %AUTH_SERVER% proxy-server diff --git a/files/swift/rsyslog.conf b/files/swift/rsyslog.conf new file mode 100644 index 0000000000..011c893b91 --- /dev/null +++ b/files/swift/rsyslog.conf @@ -0,0 +1,26 @@ +# Uncomment the following to have a log containing all logs together +#local1,local2,local3,local4,local5.* %SWIFT_LOGDIR%/all.log + +# Uncomment the following to have hourly proxy logs for stats processing +#$template HourlyProxyLog,"%SWIFT_LOGDIR%/hourly/%$YEAR%%$MONTH%%$DAY%%$HOUR%" +#local1.*;local1.!notice ?HourlyProxyLog + +local1.*;local1.!notice %SWIFT_LOGDIR%/proxy.log +local1.notice %SWIFT_LOGDIR%/proxy.error +local1.* ~ + +local2.*;local2.!notice %SWIFT_LOGDIR%/storage1.log +local2.notice %SWIFT_LOGDIR%/storage1.error +local2.* ~ + +local3.*;local3.!notice %SWIFT_LOGDIR%/storage2.log +local3.notice %SWIFT_LOGDIR%/storage2.error +local3.* ~ + +local4.*;local4.!notice %SWIFT_LOGDIR%/storage3.log +local4.notice %SWIFT_LOGDIR%/storage3.error +local4.* ~ + +local5.*;local5.!notice %SWIFT_LOGDIR%/storage4.log +local5.notice %SWIFT_LOGDIR%/storage4.error +local5.* ~ diff --git a/stack.sh b/stack.sh index cdba54258c..bc7af6598c 100755 --- a/stack.sh +++ b/stack.sh @@ -757,9 +757,10 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then USER_GROUP=$(id -g) sudo mkdir -p ${SWIFT_DATA_LOCATION}/drives - sudo chown -R $USER:${USER_GROUP} ${SWIFT_DATA_LOCATION}/drives + sudo chown -R $USER:${USER_GROUP} ${SWIFT_DATA_LOCATION} # We then create a loopback disk and format it to XFS. + # TODO: Reset disks on new pass. if [[ ! -e ${SWIFT_DATA_LOCATION}/drives/images/swift.img ]]; then mkdir -p ${SWIFT_DATA_LOCATION}/drives/images sudo touch ${SWIFT_DATA_LOCATION}/drives/images/swift.img @@ -853,6 +854,17 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then generate_swift_configuration container 6011 2 generate_swift_configuration account 6012 2 + + # We have some specific configuration for swift for rsyslog. See + # the file /etc/rsyslog.d/10-swift.conf for more info. + swift_log_dir=${SWIFT_DATA_LOCATION}/logs + rm -rf ${swift_log_dir} + mkdir -p ${swift_log_dir}/hourly + sudo chown -R syslog:adm ${swift_log_dir} + sed "s,%SWIFT_LOGDIR%,${swift_log_dir}," $FILES/swift/rsyslog.conf | sudo \ + tee /etc/rsyslog.d/10-swift.conf + sudo restart rsyslog + # We create two helper scripts : # # - swift-remakerings