From bd92c63d41f422a8e2401b84f083aadc650a646f Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Fri, 26 Aug 2022 16:45:19 +0900 Subject: [PATCH] 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 Change-Id: Idb3d73309588a7436cd2e067121119c5878eee18 --- manifests/wsgi/apache.pp | 24 +++++++++++++++++++ manifests/wsgi/apache_api.pp | 24 +++++++++++++++++++ manifests/wsgi/apache_api_cfn.pp | 24 +++++++++++++++++++ ...pd-logs-piped-syslog-19ff4bc8b76955cc.yaml | 6 +++++ spec/classes/heat_wsgi_apache_api_cfn_spec.rb | 5 ++++ spec/classes/heat_wsgi_apache_api_spec.rb | 5 ++++ 6 files changed, 88 insertions(+) create mode 100644 releasenotes/notes/httpd-logs-piped-syslog-19ff4bc8b76955cc.yaml diff --git a/manifests/wsgi/apache.pp b/manifests/wsgi/apache.pp index 9c4d88cf..bb10ce54 100644 --- a/manifests/wsgi/apache.pp +++ b/manifests/wsgi/apache.pp @@ -70,6 +70,14 @@ # The log file name for the virtualhost. # 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*] # The log format for the virtualhost. # Optional. Defaults to undef. @@ -78,6 +86,14 @@ # 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. +# # [*custom_wsgi_process_options*] # (optional) gives you the opportunity to add custom process options or to # overwrite the default options for the WSGI main process. @@ -128,8 +144,12 @@ define heat::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_process_display_name = undef, $headers = undef, @@ -175,7 +195,11 @@ define heat::wsgi::apache ( custom_wsgi_process_options => $custom_wsgi_process_options, allow_encoded_slashes => 'on', 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/manifests/wsgi/apache_api.pp b/manifests/wsgi/apache_api.pp index 0e7998b0..4febe20e 100644 --- a/manifests/wsgi/apache_api.pp +++ b/manifests/wsgi/apache_api.pp @@ -65,6 +65,14 @@ # The log file name for the virtualhost. # 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*] # The log format for the virtualhost. # Optional. Defaults to undef. @@ -73,6 +81,14 @@ # 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. +# # [*custom_wsgi_process_options*] # (optional) gives you the opportunity to add custom process options or to # overwrite the default options for the WSGI main process. @@ -124,8 +140,12 @@ class heat::wsgi::apache_api ( $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_process_display_name = undef, $headers = undef, @@ -150,8 +170,12 @@ class heat::wsgi::apache_api ( threads => $threads, priority => $priority, 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, custom_wsgi_process_options => $custom_wsgi_process_options, wsgi_process_display_name => $wsgi_process_display_name, headers => $headers, diff --git a/manifests/wsgi/apache_api_cfn.pp b/manifests/wsgi/apache_api_cfn.pp index 7677e51c..ad5752f3 100644 --- a/manifests/wsgi/apache_api_cfn.pp +++ b/manifests/wsgi/apache_api_cfn.pp @@ -65,6 +65,14 @@ # The log file name for the virtualhost. # 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*] # The log format for the virtualhost. # Optional. Defaults to undef. @@ -73,6 +81,14 @@ # 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. +# # [*custom_wsgi_process_options*] # (optional) gives you the opportunity to add custom process options or to # overwrite the default options for the WSGI main process. @@ -125,8 +141,12 @@ class heat::wsgi::apache_api_cfn ( $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_process_display_name = undef, $headers = undef, @@ -163,8 +183,12 @@ class heat::wsgi::apache_api_cfn ( threads => $threads, priority => $priority, 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, custom_wsgi_process_options => $custom_wsgi_process_options, wsgi_process_display_name => $wsgi_process_display_name, headers => $headers, diff --git a/releasenotes/notes/httpd-logs-piped-syslog-19ff4bc8b76955cc.yaml b/releasenotes/notes/httpd-logs-piped-syslog-19ff4bc8b76955cc.yaml new file mode 100644 index 00000000..07cadc9e --- /dev/null +++ b/releasenotes/notes/httpd-logs-piped-syslog-19ff4bc8b76955cc.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/heat_wsgi_apache_api_cfn_spec.rb b/spec/classes/heat_wsgi_apache_api_cfn_spec.rb index 9955e507..2048ee99 100644 --- a/spec/classes/heat_wsgi_apache_api_cfn_spec.rb +++ b/spec/classes/heat_wsgi_apache_api_cfn_spec.rb @@ -26,7 +26,12 @@ describe 'heat::wsgi::apache_api_cfn' do :request_headers => ['set Content-Type "application/json"'], :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 end diff --git a/spec/classes/heat_wsgi_apache_api_spec.rb b/spec/classes/heat_wsgi_apache_api_spec.rb index b07d47d1..bed09d1a 100644 --- a/spec/classes/heat_wsgi_apache_api_spec.rb +++ b/spec/classes/heat_wsgi_apache_api_spec.rb @@ -26,7 +26,12 @@ describe 'heat::wsgi::apache_api' do :request_headers => nil, :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 end