diff --git a/manifests/wsgi/apache.pp b/manifests/wsgi/apache.pp index b9aa7b75..bdc6317e 100644 --- a/manifests/wsgi/apache.pp +++ b/manifests/wsgi/apache.pp @@ -69,15 +69,33 @@ # # [*access_log_file*] # (Optional) The log file name for the virtualhost. -# Defaults to undef +# Defaults to undef. +# +# [*access_log_pipe*] +# (Optional) Specifies a pipe where Apache sends access logs for +# the virtualhost. +# Defaults to undef. +# +# [*access_log_syslog*] +# (Optional) Sends the virtualhost access log messages to syslog. +# Defaults to undef. # # [*access_log_format*] # (Optional) The log format for the virtualhost. -# Defaults to undef +# Defaults to undef. # # [*error_log_file*] # (Optional) The error log file name for the virtualhost. -# Defaults to undef +# Defaults to undef. +# +# [*error_log_pipe*] +# (Optional) Specifies a pipe where Apache sends error logs for +# the virtualhost. +# Defaults to undef. +# +# [*error_log_syslog*] +# (Optional) Sends the virtualhost error log messages to syslog. +# Defaults to undef. # # [*custom_wsgi_process_options*] # (Optional) gives you the opportunity to add custom process options or to @@ -131,8 +149,12 @@ class octavia::wsgi::apache ( $threads = 1, $priority = 10, $access_log_file = undef, + $access_log_pipe = undef, + $access_log_syslog = undef, $access_log_format = undef, $error_log_file = undef, + $error_log_pipe = undef, + $error_log_syslog = undef, $custom_wsgi_process_options = {}, $wsgi_script_dir = $::octavia::params::octavia_wsgi_script_path, $wsgi_script_source = $::octavia::params::octavia_wsgi_script_source, @@ -174,7 +196,11 @@ class octavia::wsgi::apache ( request_headers => $request_headers, custom_wsgi_process_options => $custom_wsgi_process_options, 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, } } diff --git a/releasenotes/notes/httpd-logs-piped-syslog-a6a544a20b4913cd.yaml b/releasenotes/notes/httpd-logs-piped-syslog-a6a544a20b4913cd.yaml new file mode 100644 index 00000000..07cadc9e --- /dev/null +++ b/releasenotes/notes/httpd-logs-piped-syslog-a6a544a20b4913cd.yaml @@ -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. diff --git a/spec/classes/octavia_wsgi_apache_spec.rb b/spec/classes/octavia_wsgi_apache_spec.rb index daeb7f6d..e08aa074 100644 --- a/spec/classes/octavia_wsgi_apache_spec.rb +++ b/spec/classes/octavia_wsgi_apache_spec.rb @@ -22,7 +22,12 @@ describe 'octavia::wsgi::apache' do :wsgi_script_source => platform_params[:wsgi_script_source], :custom_wsgi_process_options => {}, :access_log_file => nil, + :access_log_pipe => nil, + :access_log_syslog => nil, :access_log_format => nil, + :error_log_file => nil, + :error_log_pipe => nil, + :error_log_syslog => nil, )} end @@ -38,9 +43,6 @@ describe 'octavia::wsgi::apache' do :custom_wsgi_process_options => { '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', :wsgi_script_dir => '/var/lib/openstack/cgi-bin/octavia', :wsgi_script_source => '/my/path/app.wsgi', :headers => ['set X-XSS-Protection "1; mode=block"'], @@ -71,9 +73,70 @@ describe 'octavia::wsgi::apache' do :custom_wsgi_process_options => { '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' + )} + end + + 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('octavia_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('octavia_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('octavia_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('octavia_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('octavia_wsgi').with( + :error_log_pipe => params[:error_log_pipe], )} end end