Add Apache WSGI logging parameters for pipe/syslog
Add parameters for advanced logging configurations in Apache to support piped logging and support for syslog (via mod_syslog available in Apache >= 2.5.0) Co-Authored-By: Andy Botting <andy@andybotting.com> Change-Id: Ifa33b2e84284d8032c4e4f54acb26c30fc285cb5
This commit is contained in:
@@ -74,6 +74,14 @@
|
|||||||
# The log file name for the virtualhost.
|
# The log file name for the virtualhost.
|
||||||
# Optional. Defaults to undef.
|
# Optional. Defaults to undef.
|
||||||
#
|
#
|
||||||
|
# [*access_log_pipe*]
|
||||||
|
# Specifies a pipe where Apache sends access logs for the virtualhost.
|
||||||
|
# Optional. Defaults to undef.
|
||||||
|
#
|
||||||
|
# [*access_log_syslog*]
|
||||||
|
# Sends the virtualhost access log messages to syslog.
|
||||||
|
# Optional. Defaults to undef.
|
||||||
|
#
|
||||||
# [*access_log_format*]
|
# [*access_log_format*]
|
||||||
# The log format for the virtualhost.
|
# The log format for the virtualhost.
|
||||||
# Optional. Defaults to undef.
|
# Optional. Defaults to undef.
|
||||||
@@ -82,6 +90,14 @@
|
|||||||
# The error log file name for the virtualhost.
|
# The error log file name for the virtualhost.
|
||||||
# Optional. Defaults to undef.
|
# 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.
|
||||||
|
#
|
||||||
# [*custom_wsgi_process_options*]
|
# [*custom_wsgi_process_options*]
|
||||||
# (optional) gives you the opportunity to add custom process options or to
|
# (optional) gives you the opportunity to add custom process options or to
|
||||||
# overwrite the default options for the WSGI main process.
|
# overwrite the default options for the WSGI main process.
|
||||||
@@ -131,8 +147,12 @@ class gnocchi::wsgi::apache (
|
|||||||
$threads = 1,
|
$threads = 1,
|
||||||
$priority = 10,
|
$priority = 10,
|
||||||
$access_log_file = undef,
|
$access_log_file = undef,
|
||||||
|
$access_log_pipe = undef,
|
||||||
|
$access_log_syslog = undef,
|
||||||
$access_log_format = undef,
|
$access_log_format = undef,
|
||||||
$error_log_file = undef,
|
$error_log_file = undef,
|
||||||
|
$error_log_pipe = undef,
|
||||||
|
$error_log_syslog = undef,
|
||||||
$custom_wsgi_process_options = {},
|
$custom_wsgi_process_options = {},
|
||||||
$headers = undef,
|
$headers = undef,
|
||||||
$request_headers = undef,
|
$request_headers = undef,
|
||||||
@@ -171,9 +191,13 @@ class gnocchi::wsgi::apache (
|
|||||||
wsgi_script_source => $::gnocchi::params::gnocchi_wsgi_script_source,
|
wsgi_script_source => $::gnocchi::params::gnocchi_wsgi_script_source,
|
||||||
headers => $headers,
|
headers => $headers,
|
||||||
request_headers => $request_headers,
|
request_headers => $request_headers,
|
||||||
|
custom_wsgi_process_options => $custom_wsgi_process_options,
|
||||||
access_log_file => $access_log_file,
|
access_log_file => $access_log_file,
|
||||||
|
access_log_pipe => $access_log_pipe,
|
||||||
|
access_log_syslog => $access_log_syslog,
|
||||||
access_log_format => $access_log_format,
|
access_log_format => $access_log_format,
|
||||||
error_log_file => $error_log_file,
|
error_log_file => $error_log_file,
|
||||||
custom_wsgi_process_options => $custom_wsgi_process_options,
|
error_log_pipe => $error_log_pipe,
|
||||||
|
error_log_syslog => $error_log_syslog,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Added parameters for advanced configuration of httpd access and error log
|
||||||
|
destinations including piped logging and syslog (see `mod_syslog`). Note
|
||||||
|
that mod_syslog requires Apache2 >= 2.5.0.
|
@@ -24,7 +24,12 @@ describe 'gnocchi::wsgi::apache' do
|
|||||||
:request_headers => nil,
|
:request_headers => nil,
|
||||||
:custom_wsgi_process_options => {},
|
:custom_wsgi_process_options => {},
|
||||||
:access_log_file => nil,
|
:access_log_file => nil,
|
||||||
|
:access_log_pipe => nil,
|
||||||
|
:access_log_syslog => nil,
|
||||||
:access_log_format => nil,
|
:access_log_format => nil,
|
||||||
|
:error_log_file => nil,
|
||||||
|
:error_log_pipe => nil,
|
||||||
|
:error_log_syslog => nil,
|
||||||
)}
|
)}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -41,9 +46,6 @@ describe 'gnocchi::wsgi::apache' do
|
|||||||
:custom_wsgi_process_options => {
|
:custom_wsgi_process_options => {
|
||||||
'python_path' => '/my/python/path',
|
'python_path' => '/my/python/path',
|
||||||
},
|
},
|
||||||
:access_log_file => '/var/log/httpd/access_log',
|
|
||||||
:access_log_format => 'some format',
|
|
||||||
:error_log_file => '/var/log/httpd/error_log',
|
|
||||||
:headers => ['set X-XSS-Protection "1; mode=block"'],
|
:headers => ['set X-XSS-Protection "1; mode=block"'],
|
||||||
:request_headers => ['set Content-Type "application/json"'],
|
:request_headers => ['set Content-Type "application/json"'],
|
||||||
:vhost_custom_fragment => 'Timeout 99'
|
:vhost_custom_fragment => 'Timeout 99'
|
||||||
@@ -73,9 +75,70 @@ describe 'gnocchi::wsgi::apache' do
|
|||||||
:custom_wsgi_process_options => {
|
:custom_wsgi_process_options => {
|
||||||
'python_path' => '/my/python/path',
|
'python_path' => '/my/python/path',
|
||||||
},
|
},
|
||||||
:access_log_file => '/var/log/httpd/access_log',
|
)}
|
||||||
:access_log_format => 'some format',
|
end
|
||||||
:error_log_file => '/var/log/httpd/error_log'
|
|
||||||
|
context 'with custom access logging' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:access_log_format => 'foo',
|
||||||
|
:access_log_syslog => 'syslog:local0',
|
||||||
|
:error_log_syslog => 'syslog:local1',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should contain_openstacklib__wsgi__apache('gnocchi_wsgi').with(
|
||||||
|
:access_log_format => params[:access_log_format],
|
||||||
|
:access_log_syslog => params[:access_log_syslog],
|
||||||
|
:error_log_syslog => params[:error_log_syslog],
|
||||||
|
)}
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with access_log_file' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:access_log_file => '/path/to/file',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should contain_openstacklib__wsgi__apache('gnocchi_wsgi').with(
|
||||||
|
:access_log_file => params[:access_log_file],
|
||||||
|
)}
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with access_log_pipe' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:access_log_pipe => 'pipe',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should contain_openstacklib__wsgi__apache('gnocchi_wsgi').with(
|
||||||
|
:access_log_pipe => params[:access_log_pipe],
|
||||||
|
)}
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with error_log_file' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:error_log_file => '/path/to/file',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should contain_openstacklib__wsgi__apache('gnocchi_wsgi').with(
|
||||||
|
:error_log_file => params[:error_log_file],
|
||||||
|
)}
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with error_log_pipe' do
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:error_log_pipe => 'pipe',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should contain_openstacklib__wsgi__apache('gnocchi_wsgi').with(
|
||||||
|
:error_log_pipe => params[:error_log_pipe],
|
||||||
)}
|
)}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user