Add vhost access/error logs file/syslog options

Support vhosts logging to syslog.

Related-bug: #1700045

Change-Id: If60cb8e31c46e32ba6e04f53ac73a72bf989df2d
Signed-off-by: Bogdan Dobrelya <bogdando@mail.ru>
This commit is contained in:
Bogdan Dobrelya 2017-07-31 14:18:34 +02:00
parent c419058823
commit a3d852f76d
3 changed files with 63 additions and 0 deletions

View File

@ -138,10 +138,34 @@
# { python-path => '/my/python/virtualenv' }
# Defaults to {}
#
# [*access_log_file*]
# The log file name for the virtualhost.
# Optional. Defaults to false.
#
# [*access_log_pipe*]
# Specifies a pipe where Apache sends access logs for the virtualhost.
# Optional. Defaults to false.
#
# [*access_log_syslog*]
# Sends the virtualhost access log messages to syslog.
# Optional. Defaults to false.
#
# [*access_log_format*]
# The log format for the virtualhost.
# Optional. Defaults to false.
#
# [*error_log_file*]
# The error log file name for the virtualhost.
# Optional. Defaults to undef.
#
# [*error_log_pipe*]
# Specifies a pipe where Apache sends error logs for the virtualhost.
# Optional. Defaults to undef.
#
# [*error_log_syslog*]
# Sends the virtualhost error log messages to syslog.
# Optional. Defaults to undef.
#
# [*headers*]
# (optional) Headers for the vhost.
# Defaults to undef.
@ -212,7 +236,13 @@ class keystone::wsgi::apache (
$wsgi_admin_script_source = $::keystone::params::keystone_wsgi_admin_script_path,
$wsgi_public_script_source = $::keystone::params::keystone_wsgi_public_script_path,
$wsgi_script_ensure = undef,
$access_log_file = false,
$access_log_pipe = false,
$access_log_syslog = false,
$access_log_format = false,
$error_log_file = undef,
$error_log_pipe = undef,
$error_log_syslog = undef,
$headers = undef,
$vhost_custom_fragment = undef,
$custom_wsgi_process_options_main = {},
@ -382,7 +412,13 @@ class keystone::wsgi::apache (
custom_fragment => $vhost_custom_fragment,
wsgi_chunked_request => $wsgi_chunked_request,
require => File['keystone_wsgi_main'],
access_log_file => $access_log_file,
access_log_pipe => $access_log_pipe,
access_log_syslog => $access_log_syslog,
access_log_format => $access_log_format,
error_log_file => $error_log_file,
error_log_pipe => $error_log_pipe,
error_log_syslog => $error_log_syslog,
}
if $public_port != $admin_port {
@ -413,7 +449,13 @@ class keystone::wsgi::apache (
custom_fragment => $vhost_custom_fragment,
wsgi_chunked_request => $wsgi_chunked_request,
require => File['keystone_wsgi_admin'],
access_log_file => $access_log_file,
access_log_pipe => $access_log_pipe,
access_log_syslog => $access_log_syslog,
access_log_format => $access_log_format,
error_log_file => $error_log_file,
error_log_pipe => $error_log_pipe,
error_log_syslog => $error_log_syslog,
}
}
}

View File

@ -0,0 +1,7 @@
---
features:
- |
Added parameters for advanced configuration of httpd access and error logs
destinations, like syslog (see `mod_syslog`). Note that this feature
requires Apache2 >= 2.5.0. Lesser versions do not provide the required
`mod_syslog` module.

View File

@ -74,7 +74,13 @@ describe 'keystone::wsgi::apache' do
'wsgi_pass_authorization' => 'On',
'headers' => nil,
'require' => 'File[keystone_wsgi_admin]',
'access_log_file' => false,
'access_log_pipe' => false,
'access_log_syslog' => false,
'access_log_format' => false,
'error_log_file' => nil,
'error_log_pipe' => nil,
'error_log_syslog' => nil,
)}
it { is_expected.to contain_apache__vhost('keystone_wsgi_main').with(
@ -99,7 +105,13 @@ describe 'keystone::wsgi::apache' do
'wsgi_pass_authorization' => 'On',
'headers' => nil,
'require' => 'File[keystone_wsgi_main]',
'access_log_file' => false,
'access_log_pipe' => false,
'access_log_syslog' => false,
'access_log_format' => false,
'error_log_file' => nil,
'error_log_pipe' => nil,
'error_log_syslog' => nil,
)}
it { is_expected.to contain_concat("#{platform_parameters[:httpd_ports_file]}") }
end
@ -307,11 +319,13 @@ describe 'keystone::wsgi::apache' do
{
:servername => 'dummy.host',
:access_log_format => 'foo',
:access_log_syslog => 'syslog:local0',
}
end
it { is_expected.to contain_apache__vhost('keystone_wsgi_main').with(
'servername' => 'dummy.host',
'access_log_format' => 'foo',
'access_log_syslog' => 'syslog:local0',
)}
end