Browse code

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

Chmouel Boudjnah authored on 2011/11/22 21:04:40
Showing 3 changed files
... ...
@@ -1,8 +1,11 @@
1 1
 [DEFAULT]
2 2
 bind_port = 8080
3 3
 user = %USER%
4
-log_facility = LOG_LOCAL1
5 4
 swift_dir = %SWIFT_CONFIG_LOCATION%
5
+workers = 1
6
+log_name = swift
7
+log_facility = LOG_LOCAL1
8
+log_level = DEBUG
6 9
 
7 10
 [pipeline:main]
8 11
 pipeline = healthcheck cache %AUTH_SERVER% proxy-server
9 12
new file mode 100644
... ...
@@ -0,0 +1,26 @@
0
+# Uncomment the following to have a log containing all logs together
1
+#local1,local2,local3,local4,local5.*   %SWIFT_LOGDIR%/all.log
2
+
3
+# Uncomment the following to have hourly proxy logs for stats processing
4
+#$template HourlyProxyLog,"%SWIFT_LOGDIR%/hourly/%$YEAR%%$MONTH%%$DAY%%$HOUR%"
5
+#local1.*;local1.!notice ?HourlyProxyLog
6
+
7
+local1.*;local1.!notice %SWIFT_LOGDIR%/proxy.log
8
+local1.notice           %SWIFT_LOGDIR%/proxy.error
9
+local1.*                ~
10
+
11
+local2.*;local2.!notice %SWIFT_LOGDIR%/storage1.log
12
+local2.notice           %SWIFT_LOGDIR%/storage1.error
13
+local2.*                ~
14
+
15
+local3.*;local3.!notice %SWIFT_LOGDIR%/storage2.log
16
+local3.notice           %SWIFT_LOGDIR%/storage2.error
17
+local3.*                ~
18
+
19
+local4.*;local4.!notice %SWIFT_LOGDIR%/storage3.log
20
+local4.notice           %SWIFT_LOGDIR%/storage3.error
21
+local4.*                ~
22
+
23
+local5.*;local5.!notice %SWIFT_LOGDIR%/storage4.log
24
+local5.notice           %SWIFT_LOGDIR%/storage4.error
25
+local5.*                ~
... ...
@@ -757,9 +757,10 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
757 757
 
758 758
     USER_GROUP=$(id -g)
759 759
     sudo mkdir -p ${SWIFT_DATA_LOCATION}/drives
760
-    sudo chown -R $USER:${USER_GROUP} ${SWIFT_DATA_LOCATION}/drives
760
+    sudo chown -R $USER:${USER_GROUP} ${SWIFT_DATA_LOCATION}
761 761
 
762 762
     # We then create a loopback disk and format it to XFS.
763
+    # TODO: Reset disks on new pass.
763 764
     if [[ ! -e ${SWIFT_DATA_LOCATION}/drives/images/swift.img ]]; then
764 765
         mkdir -p  ${SWIFT_DATA_LOCATION}/drives/images
765 766
         sudo touch  ${SWIFT_DATA_LOCATION}/drives/images/swift.img
... ...
@@ -853,6 +854,17 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
853 853
    generate_swift_configuration container 6011 2
854 854
    generate_swift_configuration account 6012 2
855 855
 
856
+
857
+   # We have some specific configuration for swift for rsyslog. See
858
+   # the file /etc/rsyslog.d/10-swift.conf for more info.
859
+   swift_log_dir=${SWIFT_DATA_LOCATION}/logs
860
+   rm -rf ${swift_log_dir}
861
+   mkdir -p ${swift_log_dir}/hourly
862
+   sudo chown -R syslog:adm ${swift_log_dir}
863
+   sed "s,%SWIFT_LOGDIR%,${swift_log_dir}," $FILES/swift/rsyslog.conf | sudo \
864
+       tee /etc/rsyslog.d/10-swift.conf
865
+   sudo restart rsyslog
866
+   
856 867
    # We create two helper scripts :
857 868
    #
858 869
    # - swift-remakerings