From eb5bcb018033bd0c5df8fb2de124e73f18319052 Mon Sep 17 00:00:00 2001 From: Benedikt Trefzer Date: Tue, 7 Nov 2023 17:25:41 +0100 Subject: [PATCH] add access_log_env_var for apache vhost Allows to only requests with particular environment variables be logged. Example: set a dontlog variable for healthchecks, so healthchecks are not logged. Change-Id: I4dea75f85d2e4a2287bdcce845c4b5fa05da0ddc --- manifests/wsgi/apache.pp | 7 +++++++ .../notes/access_log_env_var-87f4bfd3356c6cd2.yaml | 8 ++++++++ spec/defines/openstacklib_wsgi_apache_spec.rb | 2 ++ 3 files changed, 17 insertions(+) create mode 100644 releasenotes/notes/access_log_env_var-87f4bfd3356c6cd2.yaml diff --git a/manifests/wsgi/apache.pp b/manifests/wsgi/apache.pp index 89a772d7..f479a186 100644 --- a/manifests/wsgi/apache.pp +++ b/manifests/wsgi/apache.pp @@ -218,6 +218,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. # error_log_file and error_log_pipe is mutually exclusive. @@ -280,6 +285,7 @@ define openstacklib::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, @@ -387,6 +393,7 @@ define openstacklib::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-87f4bfd3356c6cd2.yaml b/releasenotes/notes/access_log_env_var-87f4bfd3356c6cd2.yaml new file mode 100644 index 00000000..40f3de63 --- /dev/null +++ b/releasenotes/notes/access_log_env_var-87f4bfd3356c6cd2.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + Add access_log_env_var for apache vhost. + Allows that only requests with particular environment + variables set are logged. + Example: set a dontlog variable for healthchecks, + so healthchecks are not logged. diff --git a/spec/defines/openstacklib_wsgi_apache_spec.rb b/spec/defines/openstacklib_wsgi_apache_spec.rb index 4d6416f0..a14a1693 100644 --- a/spec/defines/openstacklib_wsgi_apache_spec.rb +++ b/spec/defines/openstacklib_wsgi_apache_spec.rb @@ -114,6 +114,7 @@ describe 'openstacklib::wsgi::apache' do :access_log_file => '/var/log/httpd/access_log', :access_log_syslog => 'syslog:local0', :access_log_format => 'some format', + :access_log_env_var => 'dontlog=1', :error_log_file => '/var/log/httpd/error_log', :error_log_syslog => 'syslog:local0', :log_level => 'reqtimeout:info', @@ -153,6 +154,7 @@ describe 'openstacklib::wsgi::apache' do :access_log_file => '/var/log/httpd/access_log', :access_log_syslog => 'syslog:local0', :access_log_format => 'some format', + :access_log_env_var => 'dontlog=1', :error_log_file => '/var/log/httpd/error_log', :error_log_syslog => 'syslog:local0', :log_level => 'reqtimeout:info',