From a45143dd47f0881d7092770159d3735a3a0ced0f Mon Sep 17 00:00:00 2001 From: Benedikt Trefzer Date: Wed, 23 Oct 2024 15:16:42 +0200 Subject: [PATCH] add access_log_env_var parameter to cinder::wsgi::apache Change-Id: Ibdc4a04cc5587e4a67f2bac83d8b0fed6dfb2e48 --- manifests/wsgi/apache.pp | 7 +++++++ .../access_log_env_var-f72d94f7a7e13b6e.yaml | 5 +++++ spec/classes/cinder_wsgi_apache_spec.rb | 15 +++++++++------ 3 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 releasenotes/notes/access_log_env_var-f72d94f7a7e13b6e.yaml diff --git a/manifests/wsgi/apache.pp b/manifests/wsgi/apache.pp index 1995b380..7a29da72 100644 --- a/manifests/wsgi/apache.pp +++ b/manifests/wsgi/apache.pp @@ -83,6 +83,11 @@ # (Optional) The log format for the virtualhost. # Defaults to undef. # +# [*access_log_env_var*] +# (Optional) Specifies that only requests with particular +# environment variables be logged. +# Defaults to undef. +# # [*error_log_file*] # (Optional) The error log file name for the virtualhost. # Defaults to undef. @@ -148,6 +153,7 @@ class cinder::wsgi::apache ( $access_log_pipe = undef, $access_log_syslog = undef, $access_log_format = undef, + $access_log_env_var = undef, $error_log_file = undef, $error_log_pipe = undef, $error_log_syslog = undef, @@ -194,6 +200,7 @@ class cinder::wsgi::apache ( access_log_pipe => $access_log_pipe, access_log_syslog => $access_log_syslog, access_log_format => $access_log_format, + access_log_env_var => $access_log_env_var, error_log_file => $error_log_file, error_log_pipe => $error_log_pipe, error_log_syslog => $error_log_syslog, diff --git a/releasenotes/notes/access_log_env_var-f72d94f7a7e13b6e.yaml b/releasenotes/notes/access_log_env_var-f72d94f7a7e13b6e.yaml new file mode 100644 index 00000000..420521b7 --- /dev/null +++ b/releasenotes/notes/access_log_env_var-f72d94f7a7e13b6e.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Add the ``access_log_env_var`` parameter to the ``cinder::wsgi::apache`` + class to allow filtering logs (eg. suppress healthecks) diff --git a/spec/classes/cinder_wsgi_apache_spec.rb b/spec/classes/cinder_wsgi_apache_spec.rb index c43d68e3..627a684b 100644 --- a/spec/classes/cinder_wsgi_apache_spec.rb +++ b/spec/classes/cinder_wsgi_apache_spec.rb @@ -26,6 +26,7 @@ describe 'cinder::wsgi::apache' do :access_log_pipe => nil, :access_log_syslog => nil, :access_log_format => nil, + :access_log_env_var => nil, :error_log_file => nil, :error_log_pipe => nil, :error_log_syslog => nil, @@ -78,16 +79,18 @@ describe 'cinder::wsgi::apache' do context 'with custom access logging' do let :params do { - :access_log_format => 'foo', - :access_log_syslog => 'syslog:local0', - :error_log_syslog => 'syslog:local1', + :access_log_format => 'foo', + :access_log_syslog => 'syslog:local0', + :error_log_syslog => 'syslog:local1', + :access_log_env_var => '!dontlog', } end it { should contain_openstacklib__wsgi__apache('cinder_wsgi').with( - :access_log_format => params[:access_log_format], - :access_log_syslog => params[:access_log_syslog], - :error_log_syslog => params[:error_log_syslog], + :access_log_format => params[:access_log_format], + :access_log_syslog => params[:access_log_syslog], + :error_log_syslog => params[:error_log_syslog], + :access_log_env_var => params[:access_log_env_var], )} end