Add parameter for Apache LogLevel in error logfile

Add the log_level parameter to control LogLevel for Apache vhost.
By default, Apache only logs warnings and errors in its errors logfile,
while request timeouts are logged by mod_reqtimeout at LogLevel info.
Default error_log_level value is not defined, which corresponds to
the default Apache's LogLevel warn.

Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
Change-Id: I6d55e1e7cda191ab03b90de51fea5a063d57ca63
This commit is contained in:
Bogdan Dobrelya 2022-04-15 10:34:04 +02:00 committed by Takashi Kajinami
parent 33fb90326f
commit f780769122
3 changed files with 21 additions and 4 deletions

View File

@ -232,6 +232,10 @@
# (Optional) Sends the virtualhost error log messages to syslog.
# Defaults to undef
#
# [*log_level*]
# (Optional) Specifies LogLevel for Apache WSGI.
# Defaults to undef
#
define openstacklib::wsgi::apache (
$service_name = $name,
$servername = $::fqdn,
@ -279,6 +283,7 @@ define openstacklib::wsgi::apache (
$error_log_file = undef,
$error_log_pipe = undef,
$error_log_syslog = undef,
$log_level = undef,
) {
include apache
@ -389,6 +394,7 @@ define openstacklib::wsgi::apache (
error_log_file => $error_log_file,
error_log_pipe => $error_log_pipe,
error_log_syslog => $error_log_syslog,
log_level => $log_level,
options => ['-Indexes', '+FollowSymLinks','+MultiViews'],
}

View File

@ -0,0 +1,8 @@
---
features:
- |
Add `log_level` parameter to control `LogLevel` for Apache vhost.
By default, Apache only logs warnings and errors in its errors logfile,
while request timeouts are logged by `mod_reqtimeout` at LogLevel info.
Default `log_level` value is not defined, which corresponds to
the default Apache `LogLevel warn`.

View File

@ -100,6 +100,7 @@ describe 'openstacklib::wsgi::apache' do
:error_log_file => nil,
:error_log_pipe => nil,
:error_log_syslog => nil,
:log_level => nil,
:options => ['-Indexes', '+FollowSymLinks','+MultiViews'],
)}
@ -114,11 +115,11 @@ describe 'openstacklib::wsgi::apache' do
:wsgi_script_source => '/usr/share/keystone/keystone.wsgi',
:wsgi_pass_authorization => 'On',
:wsgi_chunked_request => 'On',
:custom_wsgi_script_aliases => { '/admin' => '/var/www/cgi-bin/keystone/admin' },
:custom_wsgi_script_aliases => { '/admin' => '/var/www/cgi-bin/keystone/admin' },
:headers => 'set X-Frame-Options "DENY"',
:request_headers => 'set Content-Type "application/json"',
:aliases => [
{ 'alias' => '/robots.txt', 'path' => '/etc/keystone/robots.txt', },
{ 'alias' => '/robots.txt', 'path' => '/etc/keystone/robots.txt', },
],
:servername => 'dummy.host',
:bind_host => '10.42.51.1',
@ -134,7 +135,8 @@ describe 'openstacklib::wsgi::apache' do
:access_log_syslog => 'syslog:local0',
:access_log_format => 'some format',
:error_log_file => '/var/log/httpd/error_log',
:error_log_syslog => 'syslog:local0'
:error_log_syslog => 'syslog:local0',
:log_level => 'reqtimeout:info',
}
end
@ -172,7 +174,8 @@ describe 'openstacklib::wsgi::apache' do
:access_log_syslog => 'syslog:local0',
:access_log_format => 'some format',
:error_log_file => '/var/log/httpd/error_log',
:error_log_syslog => 'syslog:local0'
:error_log_syslog => 'syslog:local0',
:log_level => 'reqtimeout:info',
)}
end