provide means to disable log_requests in config templates

it is hard coded into account, object and container config templates to log
every request. Provide a means to disable log_requests via
swift::storage::server and swift::storage::all, this reduces the log output.

Change-Id: I2fd97c1406710bb0305955f8ff9b47f91c09e13d
Closes-Bug: #1484614
This commit is contained in:
Benedikt von St. Vieth 2015-09-04 20:39:01 +02:00
parent 96b4f5c7c5
commit c2bb2fb31e
7 changed files with 30 additions and 5 deletions

View File

@ -58,6 +58,11 @@
# (optional) Port value for UDP receiver, if enabled.
# Defaults to undef.
#
# [*log_requests*]
# (optional) Whether or not log every request. reduces logging output if false,
# good for seeing errors if true
# Defaults to true.
#
# [*incoming_chmod*] Incoming chmod to set in the rsync server.
# Optional. Defaults to 0644 for maintaining backwards compatibility.
# *NOTE*: Recommended parameter: 'Du=rwx,g=rx,o=rx,Fu=rw,g=r,o=r'
@ -83,6 +88,7 @@ class swift::storage::all(
$log_level = 'INFO',
$log_udp_host = undef,
$log_udp_port = undef,
$log_requests = true,
$incoming_chmod = '0644',
$outgoing_chmod = '0644',
) {
@ -105,6 +111,7 @@ class swift::storage::all(
config_file_path => 'account-server.conf',
pipeline => $account_pipeline,
log_facility => $log_facility,
log_requests => $log_requests,
incoming_chmod => $incoming_chmod,
outgoing_chmod => $outgoing_chmod,
}
@ -115,6 +122,7 @@ class swift::storage::all(
pipeline => $container_pipeline,
log_facility => $log_facility,
allow_versions => $allow_versions,
log_requests => $log_requests,
incoming_chmod => $incoming_chmod,
outgoing_chmod => $outgoing_chmod,
}
@ -124,6 +132,7 @@ class swift::storage::all(
config_file_path => 'object-server.conf',
pipeline => $object_pipeline,
log_facility => $log_facility,
log_requests => $log_requests,
incoming_chmod => $incoming_chmod,
outgoing_chmod => $outgoing_chmod,
}

View File

@ -102,6 +102,11 @@
# (optional) Port value for UDP receiver, if enabled.
# Defaults to undef.
#
# [*log_requests*]
# (optional) Whether or not log every request. reduces logging output if false,
# good for seeing errors if true
# Defaults to true.
#
# [*config_file_path*]
# (optional) The configuration file name.
# Defaults to "${type}-server/${name}.conf".
@ -129,6 +134,7 @@ define swift::storage::server(
$log_name = "${type}-server",
$log_udp_host = undef,
$log_udp_port = undef,
$log_requests = true,
# this parameters needs to be specified after type and name
$config_file_path = "${type}-server/${name}.conf"
) {

View File

@ -22,7 +22,8 @@ describe 'swift::storage::all' do
:account_port => '6002',
:log_facility => 'LOG_LOCAL2',
:incoming_chmod => '0644',
:outgoing_chmod => '0644'
:outgoing_chmod => '0644',
:log_requests => true
}
end
@ -44,6 +45,7 @@ describe 'swift::storage::all' do
:log_facility => ['LOG_LOCAL2', 'LOG_LOCAL3'],
:incoming_chmod => 'Du=rwx,g=rx,o=rx,Fu=rw,g=r,o=r',
:outgoing_chmod => 'Du=rwx,g=rx,o=rx,Fu=rw,g=r,o=r',
:log_requests => false
}
].each do |param_set|

View File

@ -21,7 +21,8 @@ describe 'swift::storage::server' do
:group => 'swift',
:incoming_chmod => '0644',
:outgoing_chmod => '0644',
:max_connections => '25'
:max_connections => '25',
:log_requests => true
}
end
@ -142,6 +143,12 @@ describe 'swift::storage::server' do
end
it { is_expected.to contain_concat("/etc/swift/#{t}-server/#{title}.conf").that_comes_before("Swift_#{t}_config[foo/bar]") }
end
describe "when log_requests is turned off" do
let :params do req_params.merge({:log_requests => false}) end
it { is_expected.to contain_file(fragment_file) \
.with_content(/^set log_requests\s*=\s*false\s*$/)
}
end
end
describe 'with all allowed defaults' do
@ -170,6 +177,7 @@ describe 'swift::storage::server' do
it { is_expected.to contain_file(fragment_file).with_content(/^set log_facility\s*=\s*LOG_LOCAL2\s*$/) }
it { is_expected.to contain_file(fragment_file).with_content(/^set log_level\s*=\s*INFO\s*$/) }
it { is_expected.to contain_file(fragment_file).with_content(/^set log_address\s*=\s*\/dev\/log\s*$/) }
it { is_expected.to contain_file(fragment_file).with_content(/^set log_requests\s*=\s*true\s*$/) }
it { is_expected.to contain_file(fragment_file).with_content(/^workers\s*=\s*1\s*$/) }
it { is_expected.to contain_file(fragment_file).with_content(/^concurrency\s*=\s*1\s*$/) }
it { is_expected.to contain_file(fragment_file).with_content(/^pipeline\s*=\s*#{t}-server\s*$/) }

View File

@ -25,7 +25,7 @@ use = egg:swift#account
set log_name = <%= @log_name %>
set log_facility = <%= @log_facility %>
set log_level = <%= @log_level %>
set log_requests = True
set log_requests = <%= @log_requests %>
set log_address = <%= @log_address %>
[account-replicator]

View File

@ -27,7 +27,7 @@ use = egg:swift#container
set log_name = <%= @log_name %>
set log_facility = <%= @log_facility %>
set log_level = <%= @log_level %>
set log_requests = True
set log_requests = <%= @log_requests %>
set log_address = <%= @log_address %>
[container-replicator]

View File

@ -25,7 +25,7 @@ use = egg:swift#object
set log_name = <%= @log_name %>
set log_facility = <%= @log_facility %>
set log_level = <%= @log_level %>
set log_requests = True
set log_requests = <%= @log_requests %>
set log_address = <%= @log_address %>
[object-replicator]