diff --git a/manifests/init.pp b/manifests/init.pp index fc1bf908..f1763f35 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -306,6 +306,10 @@ # (optional) The path to the location of static assets. # Defaults to "${::horizon::params::static_path}/openstack-dashboard" # +# [*access_log_format*] +# (optional) The log format for the access log. +# Defaults to false +# # [*session_timeout*] # (optional) The session timeout for horizon in seconds. After this many seconds of inactivity # the user is logged out. @@ -511,6 +515,7 @@ class horizon( $overview_days_range = undef, $root_url = $::horizon::params::root_url, $root_path = "${::horizon::params::static_path}/openstack-dashboard", + $access_log_format = false, $session_timeout = 1800, $timezone = 'UTC', $secure_cookies = false, @@ -653,22 +658,23 @@ class horizon( if $configure_apache { class { '::horizon::wsgi::apache': - bind_address => $bind_address, - servername => $servername, - server_aliases => $server_aliases, - listen_ssl => $listen_ssl, - http_port => $http_port, - https_port => $https_port, - ssl_redirect => $ssl_redirect, - horizon_cert => $horizon_cert, - horizon_key => $horizon_key, - horizon_ca => $horizon_ca, - wsgi_processes => $wsgi_processes, - wsgi_threads => $wsgi_threads, - extra_params => $vhost_extra_params, - redirect_type => $redirect_type, - root_url => $root_url, - root_path => $root_path, + bind_address => $bind_address, + servername => $servername, + server_aliases => $server_aliases, + listen_ssl => $listen_ssl, + http_port => $http_port, + https_port => $https_port, + ssl_redirect => $ssl_redirect, + horizon_cert => $horizon_cert, + horizon_key => $horizon_key, + horizon_ca => $horizon_ca, + wsgi_processes => $wsgi_processes, + wsgi_threads => $wsgi_threads, + extra_params => $vhost_extra_params, + redirect_type => $redirect_type, + root_url => $root_url, + root_path => $root_path, + access_log_format => $access_log_format, } } diff --git a/manifests/wsgi/apache.pp b/manifests/wsgi/apache.pp index de1d1639..7226dcd2 100644 --- a/manifests/wsgi/apache.pp +++ b/manifests/wsgi/apache.pp @@ -87,6 +87,10 @@ # (optional) The path to the location of static assets. # Defaults to "${::horizon::params::static_path}/openstack-dashboard" # +# [*access_log_format*] +# (optional) The log format to use to the access log. +# Defaults to false +# class horizon::wsgi::apache ( $bind_address = undef, $servername = $::fqdn, @@ -108,6 +112,7 @@ class horizon::wsgi::apache ( $redirect_type = 'permanent', $root_url = $::horizon::params::root_url, $root_path = "${::horizon::params::static_path}/openstack-dashboard", + $access_log_format = false, ) inherits horizon::params { include ::horizon::deps @@ -220,6 +225,7 @@ class horizon::wsgi::apache ( serveraliases => any2array($server_aliases), docroot => '/var/www/', access_log_file => 'horizon_access.log', + access_log_format => $access_log_format, error_log_file => 'horizon_error.log', priority => $priority, aliases => [{ diff --git a/releasenotes/notes/add-access-log-format-fdbdd77c94ff1abd.yaml b/releasenotes/notes/add-access-log-format-fdbdd77c94ff1abd.yaml new file mode 100644 index 00000000..a1bf2384 --- /dev/null +++ b/releasenotes/notes/add-access-log-format-fdbdd77c94ff1abd.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Added horizon::access_log_format and horizon::wsgi::apache::access_log_format + that can be used to set the log format for the access log. diff --git a/spec/classes/horizon_init_spec.rb b/spec/classes/horizon_init_spec.rb index 1566d666..ee244b5f 100644 --- a/spec/classes/horizon_init_spec.rb +++ b/spec/classes/horizon_init_spec.rb @@ -43,12 +43,13 @@ describe 'horizon' do it 'configures apache' do is_expected.to contain_class('horizon::wsgi::apache').with({ - :servername => 'some.host.tld', - :listen_ssl => false, - :wsgi_processes => facts[:os_workers], - :wsgi_threads => '1', - :extra_params => {}, - :redirect_type => 'permanent', + :servername => 'some.host.tld', + :listen_ssl => false, + :wsgi_processes => facts[:os_workers], + :wsgi_threads => '1', + :extra_params => {}, + :redirect_type => 'permanent', + :access_log_format => false, }) end @@ -291,13 +292,15 @@ describe 'horizon' do context 'with custom wsgi options' do before do - params.merge!( :wsgi_processes => '30', - :wsgi_threads => '5' ) + params.merge!( :wsgi_processes => '30', + :wsgi_threads => '5', + :access_log_format => 'common' ) end it { should contain_class('horizon::wsgi::apache').with( - :wsgi_processes => '30', - :wsgi_threads => '5', + :wsgi_processes => '30', + :wsgi_threads => '5', + :access_log_format => 'common', )} end diff --git a/spec/classes/horizon_wsgi_apache_spec.rb b/spec/classes/horizon_wsgi_apache_spec.rb index 116c5a09..e749c1a2 100644 --- a/spec/classes/horizon_wsgi_apache_spec.rb +++ b/spec/classes/horizon_wsgi_apache_spec.rb @@ -30,6 +30,7 @@ describe 'horizon::wsgi::apache' do it { should contain_apache__vhost('horizon_vhost').with( :servername => 'some.host.tld', :access_log_file => 'horizon_access.log', + :access_log_format => false, :error_log_file => 'horizon_error.log', :priority => '15', :serveraliases => ['some.host.tld'], @@ -56,10 +57,11 @@ describe 'horizon::wsgi::apache' do context 'with overridden parameters' do before do params.merge!({ - :priority => '10', - :redirect_type => 'temp', - :wsgi_processes => '13', - :wsgi_threads => '3' + :priority => '10', + :redirect_type => 'temp', + :wsgi_processes => '13', + :wsgi_threads => '3', + :access_log_format => 'common', }) end @@ -74,6 +76,7 @@ describe 'horizon::wsgi::apache' do it { should contain_apache__vhost('horizon_vhost').with( :servername => 'some.host.tld', :access_log_file => 'horizon_access.log', + :access_log_format => 'common', :error_log_file => 'horizon_error.log', :priority => params[:priority], :serveraliases => ['some.host.tld'], @@ -135,6 +138,7 @@ describe 'horizon::wsgi::apache' do it { should contain_apache__vhost('horizon_ssl_vhost').with( :servername => 'some.host.tld', :access_log_file => 'horizon_ssl_access.log', + :access_log_format => false, :error_log_file => 'horizon_ssl_error.log', :priority => '15', :serveraliases => ['some.host.tld'], @@ -158,6 +162,7 @@ describe 'horizon::wsgi::apache' do it { should contain_apache__vhost('horizon_vhost').with( :servername => 'some.host.tld', :access_log_file => 'horizon_access.log', + :access_log_format => false, :error_log_file => 'horizon_error.log', :priority => '15', :serveraliases => ['some.host.tld'],