Allow to customize log_name for services

This patch allows us to customize log_name for:
- proxy-server
- container-server
- object-server
- account-server

Which may be usefull for log collecting/parsing. Defaults remain
as they were before the patch.

Change-Id: I173652ec5bbe8d4382e10db4510d91aebceacab5
This commit is contained in:
Aleksandr Didenko 2014-10-14 17:00:32 +03:00
parent 3ea0044036
commit a2cae16d31
8 changed files with 14 additions and 4 deletions

View File

@ -34,6 +34,9 @@
# Optional but requires write_affinity to be set. Defaults to undef.
# [*package_ensure*] Ensure state of the swift proxy package.
# Optional. Defaults to present.
# [*log_name*]
# Configures log_name for swift proxy-server.
# Optional. Defaults to proxy-server
#
# == Examples
#
@ -59,6 +62,7 @@ class swift::proxy(
$log_level = 'INFO',
$log_facility = 'LOG_LOCAL1',
$log_handoffs = true,
$log_name = 'proxy-server',
$read_affinity = undef,
$write_affinity = undef,
$write_affinity_node_count = undef,

View File

@ -21,6 +21,7 @@ define swift::storage::server(
$log_facility = 'LOG_LOCAL2',
$log_level = 'INFO',
$log_address = '/dev/log',
$log_name = "${type}-server",
# this parameters needs to be specified after type and name
$config_file_path = "${type}-server/${name}.conf"
) {

View File

@ -99,6 +99,7 @@ describe 'swift::proxy' do
:allow_account_management => false,
:account_autocreate => false,
:log_level => 'DEBUG',
:log_name => 'swift-proxy-server',
:read_affinity => 'r1z1=100, r1=200',
:write_affinity => 'r1',
:write_affinity_node_count => '2 * replicas',
@ -116,6 +117,7 @@ describe 'swift::proxy' do
'pipeline = swauth proxy-server',
'[app:proxy-server]',
'use = egg:swift#proxy',
'set log_name = swift-proxy-server',
'allow_account_management = false',
'account_autocreate = false',
'read_affinity = r1z1=100, r1=200',

View File

@ -151,6 +151,9 @@ describe 'swift::storage::server' do
it { should contain_file(fragment_file) \
.with_content(/^user\s*=\s*swift\s*$/)
}
it { should contain_file(fragment_file) \
.with_content(/^set log_name\s*=\s*#{t}-server\s*$/)
}
it { should contain_file(fragment_file) \
.with_content(/^set log_facility\s*=\s*LOG_LOCAL2\s*$/)
}

View File

@ -12,7 +12,7 @@ pipeline = <%= @pipeline.to_a.join(' ') %>
[app:account-server]
use = egg:swift#account
set log_name = account-server
set log_name = <%= @log_name %>
set log_facility = <%= @log_facility %>
set log_level = <%= @log_level %>
set log_requests = True

View File

@ -14,7 +14,7 @@ pipeline = <%= @pipeline.to_a.join(' ') %>
[app:container-server]
allow_versions = <%= @allow_versions %>
use = egg:swift#container
set log_name = @container-server
set log_name = <%= @log_name %>
set log_facility = <%= @log_facility %>
set log_level = <%= @log_level %>
set log_requests = True

View File

@ -12,7 +12,7 @@ pipeline = <%= @pipeline.to_a.join(' ') %>
[app:object-server]
use = egg:swift#object
set log_name = object-server
set log_name = <%= @log_name %>
set log_facility = <%= @log_facility %>
set log_level = <%= @log_level %>
set log_requests = True

View File

@ -25,7 +25,7 @@ pipeline = <%= @pipeline.to_a.join(' ') %>
[app:proxy-server]
use = egg:swift#proxy
set log_name = proxy-server
set log_name = <%= @log_name %>
set log_facility = <%= @log_facility %>
set log_level = <%= @log_level %>
set log_address = <%= @log_address %>