From b4584daaae829b5627b0996e7296b014110dba2a Mon Sep 17 00:00:00 2001 From: newptone Date: Thu, 13 Jun 2013 18:57:27 +0800 Subject: [PATCH] Add configurable log for proxy-server service This patch add configurable log for swift proxy-server service. And add related spec test. Partially implements blueprint puppet-swift-log-support. Change-Id: I385093b3e63f8210d83ec125e6d2578b06b631d4 --- manifests/proxy.pp | 6 ++++++ spec/classes/swift_proxy_spec.rb | 8 ++++++++ templates/proxy-server.conf.erb | 17 ++++++++++++++++- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/manifests/proxy.pp b/manifests/proxy.pp index 19d301e0..77b7a5a5 100644 --- a/manifests/proxy.pp +++ b/manifests/proxy.pp @@ -45,7 +45,13 @@ class swift::proxy( $workers = $::processorcount, $allow_account_management = true, $account_autocreate = true, + $log_headers = 'False', + $log_udp_host = '', + $log_udp_port = '', + $log_address = '/dev/log', $log_level = 'INFO', + $log_facility = 'LOG_LOCAL1', + $log_handoffs = true, $package_ensure = 'present' ) { diff --git a/spec/classes/swift_proxy_spec.rb b/spec/classes/swift_proxy_spec.rb index 0f360d19..a3132824 100644 --- a/spec/classes/swift_proxy_spec.rb +++ b/spec/classes/swift_proxy_spec.rb @@ -63,11 +63,19 @@ describe 'swift::proxy' do 'bind_port = 8080', "workers = #{facts[:processorcount]}", 'user = swift', + 'log_name = swift', 'log_level = INFO', + 'log_headers = False', + 'log_address = /dev/log', '[pipeline:main]', 'pipeline = healthcheck cache tempauth proxy-server', '[app:proxy-server]', 'use = egg:swift#proxy', + 'set log_name = proxy-server', + 'set log_facility = LOG_LOCAL1', + 'set log_level = INFO', + 'set log_address = /dev/log', + 'log_handoffs = true', 'allow_account_management = true', 'account_autocreate = true' ] diff --git a/templates/proxy-server.conf.erb b/templates/proxy-server.conf.erb index b9e517e8..c55438a0 100644 --- a/templates/proxy-server.conf.erb +++ b/templates/proxy-server.conf.erb @@ -7,13 +7,28 @@ bind_ip = <%= @proxy_local_net_ip %> <% end %> workers = <%= @workers %> user = swift +log_name = swift +log_facility = <%= @log_facility %> log_level = <%= @log_level %> +log_headers = <%= @log_headers %> +log_address = <%= @log_address %> +<% if @log_udp_host != '' -%> +# If set, log_udp_host will override log_address +log_udp_host = <%= @log_udp_host -%> +<% end %> +<% if @log_udp_host !='' and @log_udp_port != '' -%> +log_udp_port = <%= @log_udp_port -%> +<% end %> [pipeline:main] pipeline = <%= @pipeline.to_a.join(' ') %> [app:proxy-server] use = egg:swift#proxy +set log_name = proxy-server +set log_facility = <%= @log_facility %> +set log_level = <%= @log_level %> +set log_address = <%= @log_address %> +log_handoffs = <%= @log_handoffs %> allow_account_management = <%= @allow_account_management %> account_autocreate = <%= @account_autocreate %> -