add access_log_env_var parameter to cinder::wsgi::apache

Change-Id: Ibdc4a04cc5587e4a67f2bac83d8b0fed6dfb2e48
This commit is contained in:
Benedikt Trefzer 2024-10-23 15:16:42 +02:00
parent 8dc51aaf6f
commit a45143dd47
3 changed files with 21 additions and 6 deletions

View File

@ -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,

View File

@ -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)

View File

@ -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